Batch error handling

From wikinotes

ERRORLEVEL

The %ERRORLEVEL% variable is roughly equivalent to bash's $?. A process-exit code of 0 indicates that a process completed successfully.

some-command.exe

IF %ERRORLEVEL% EQU 0 (
    echo No errors found
)

exit

REM exit the batch script early, with a return-code of 1
EXIT /B 1

REM exit the cmd.exe process with a return code of 1
EXIT 1