views:

85

answers:

3

Basically, let's say that I have a batch file that calls myapp1.exe and myapp1.exe exits with Exit Code 1. Can the batch file capture this information and either force the batch file to exit with that same exit code or perform some other logic?

A: 

as far as i know batch file returns last executed command status.

Tomasz Kowalczyk
+2  A: 

You could try using errorlevels. Some more info here.

cofiem
Do, or do not. There is no "try". (And in this case, if you do use the errorlevel, it will work ;)
ewall
+2  A: 
@echo off
rem ...
set errorlevel=
MyApp1.exe
exit /b %errorlevel%

would be the explicit variant.

Joey