IF ERRORLEVEL is a special syntax supported since the DOS days, the %ERRORLEVEL% variable support was added in WinNT.
The original syntax is used like this:
if errorlevel 1 goto handleerror1orhigher
if errorlevel 0 echo succuess...
To use the variable, use the normal IF syntax:
if %errorlevel%==0 echo success...</code>
Note that %errorlevel% stops working if someone does
set errorlevel=foo</code> and it might not get updated for internal cmd.exe commands.
An alternative solution is to use &&:
call someapp.exe && (echo success) || (echo error!)