Windows scripting - figuring out return / exit codes
Thursday, June 19th, 2008I just spent at least 10 minutes trying to determine the exit code for a command just executed from the command prompt. This seems like an overly simple thing to do but one that is not very well documented. The answer is to use the errorlevel environment variable.
runMyCommand.exe
After completion…
echo %errorlevel%
displays the actual code returned by the process.
Interesting doing a SET does not display this environment variable.