I wrote a batch file that restarts an application after it is quitted. But I only want this to happen when the quitting was intentional. If the application crashed, I want the batch file to not do anything but exit.
How do I test whether an application returns success or failure error code upon exit? Does this make sense?
Thanks.
[edit]
I tried this:
@echo off
e:
cd %HWRM%\Bin\Release
HomeworldRM.exe
echo The errorlevel is %errorlevel%.
pause
But it always says the errorlevel is zero, even if the game crashes.