How to run multiple .BAT files within a .BAT file

Th3Fix3r picture Th3Fix3r · Jul 9, 2009 · Viewed 885.8k times · Source

I'm trying to get my commit-build.bat to execute other .BAT files as part of our build process.

Content of commit-build.bat:

"msbuild.bat"
"unit-tests.bat"
"deploy.bat"

This seems simple enough, but commit-build.bat only executes the first item in the list (msbuild.bat).

I have run each of the files separately with no problems.

Answer

Philippe Leybaert picture Philippe Leybaert · Jul 9, 2009

Use:

call msbuild.bat
call unit-tests.bat
call deploy.bat

When not using CALL, the current batch file stops and the called batch file starts executing. It's a peculiar behavior dating back to the early MS-DOS days.