Search code examples
batch-filecmd

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


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.


Solution

  • 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.