views:

52

answers:

2

When my Windows Batch file (.bat) calls other two BAT files it exits after the first one.

How to make it run both of them?

+6  A: 

use call

e.g. in the calling batch file:

call batch1.bat
call batch2.bat

(also, some more background here.)

mikej
+2  A: 

In addition to using call as mikej notes, if you need to return an error code from one of the batch files then use

exit /b 0

I think if the last command invoked in a batch file returns a non-zero errorlevel then this is returned as the errorlevel of the batch file itself by default.

the_mandrill