Quote:
Originally Posted by StainlessS
need to detect and return ERRORLEVEL from ffmpeg call
|
1. Detecting an error level: it's easiest if you only care if %errorlevel% is zero (success) or nonzero (failure)
Code:
[try something...]
if errorlevel 1 goto failed
[do stuff]
goto :EOF
:failed
@echo failed! try again!
pause
goto :EOF
"if errorlevel 1" is true if %errorlevel% is 1, OR GREATER
If you want the exact error level, it's harder. See
this (robvanderwoude.com)
2. Returning an error level from a batch file:
To test this, after you run the batch file, type:
EDIT AutoHotkey, AutoIt, C++, C# etc can run a process and store the exit code.
EDIT sorry, it's "if errorlevel 1" not "if
%errorlevel
% 1"