exit /b exitcode returns 0 in java program

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to execute following script from a java program

a.bat
-------
EXIT /B 20
---------

The result of execution is always 0 though the exit code should have been
20. This works correctly on Windows 2003 but not in XP and 2000. Do you see a
problem with cmd.exe of Windows XP and 2000 OS or is it a JDK issue?

Thanks,
Sandeep
 
Sandeep said:
I am trying to execute following script from a java program

a.bat
-------
EXIT /B 20
---------

The result of execution is always 0 though the exit code should have been
20. This works correctly on Windows 2003 but not in XP and 2000. Do you see a
problem with cmd.exe of Windows XP and 2000 OS or is it a JDK issue?

Thanks,
Sandeep

This works very nicely under WinXP when calling a.bat from
another batch file (which you can easily test yourself). I suspect
Java does not pick up the error level.
 
Back
Top