Since I regularly forget the exact name and end up having to look this up, I’m documenting it here.
If you run an application from the command-line and want to get it’s exit status code, you use:
[bat gutter=”false”]
echo %ERRORLEVEL%
[/bat]
Beware however, if there is an environment variable called errorlevel, because it will override the exit code.
See this SO question for more information.