C#: Use exit code from application in Windows batch file (script)
That’s pretty easy stuff if you know it already.
Take a look on example (TestApp.exe):
static int Main(string[] args)
{
int myCodeNumber = 1;
// Return some code number
return myCodeNumber;
}
and here it is how to catch it in Windows batch file (test.bat):
REM Run app which will return some code number TestApp.exe REM If returned code is not == 1 then "do something" else continue to NEXT section if %errorlevel% NEQ 1 GOTO :NEXT DO SOMETHING HERE :NEXT

(115)




