IF ERRORLEVEL <N> IF NOT ERRORLEVEL <N+1> <COMMAND>
Examples
The following example executes command1 (whatever that may be) and if this command returns an exitcode 1 or greater then the dos script exits immediatly.Only if command1 returns 0, the script continous and executes command2.
@echo off
command1
if errorlevel 1 goto finally
command2
:finally
echo exit %errorlevel%
exit %errorlevel%
The following example executes command1 and if this command returns an exitcode 1 then the dos script exits immediatly.
If command1 returns 0 or a value greater than 1 the script continous and executes command2.
@echo off
command1
if errorlevel 1 if not errorlevel 2 goto finally
command2
:finally
echo exit %errorlevel%
exit %errorlevel%



