Use "errorlevel", for example:
IF ERRORLEVEL 1 GOTO ERROR
The errorlevel command is a bit strange; it returns true if the return code is equal to or higher than the specified error level. You can also write
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
This page is a good overview of how to use error levels in .bat files.
JesperE
source share