DOS - Check error level (return status) of a command
rem Call a command
sed.exe -i "s/foo/bar/g" foo.txt
rem Check status
call :check
rem Function to check error level
:check
if not "%ERRORLEVEL%"=="0" (
echo [FAIL] The command failed.
pause
exit
)
rem Important to return to the call
goto:eof