Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

How to get the application exit code from a Windows command line?

I am running a program and would like to see what its return code is (since it returns different codes based on different errors).

I know in Bash I can do this by running

echo $?

What to do when using cmd.exe on Windows?
by

2 Answers

RoliMishra
A pseudo environment variable named errorlevel stores the exit code:

echo Exit Code is %errorlevel%

Also, the if command has a special syntax:

if errorlevel
storm
..

Login / Signup to Answer the Question.