Analogous to the $?
in Linux, is there a way to get the exit status of a program in a Windows batch file (.bat
)?
Say for example the program has a System.exit(0)
upon successful execution, and a System.exit(1)
upon a failure, how do I trap these exit values in a .bat
file?
Use %ERRORLEVEL%. Don't you love how batch files are clear and concise? :)