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

前端 未结 17 1687
别跟我提以往
别跟我提以往 2020-11-22 13:59

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:



        
17条回答
  •  难免孤独
    2020-11-22 14:22

    You are calling multiple batches in an effort to compile a program. I take for granted that if an error occurs:
    1) The program within the batch will exit with an errorlevel;
    2) You want to know about it.

    for %%b in ("msbuild.bat" "unit-tests.bat" "deploy.bat") do call %%b|| exit /b 1
    

    '||' tests for an errorlevel higher than 0. This way all batches are called in order but will stop at any error, leaving the screen as it is for you to see any error message.

提交回复
热议问题