Jader Dias
Jader Dias

Reputation: 90475

How to call two batches from a third one?

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?

Upvotes: 4

Views: 556

Answers (2)

mikej
mikej

Reputation: 66263

use call

e.g. in the calling batch file:

call batch1.bat
call batch2.bat

(also, some more background here.)

Upvotes: 7

the_mandrill
the_mandrill

Reputation: 30842

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.

Upvotes: 3

Related Questions