How do I launch multiple batch files from one batch file with dependency?

前端 未结 4 497
无人及你
无人及你 2021-01-05 17:45

I want to run one batch file, that start the other batch files. I looked at a similar question posted here: How to run multiple .BAT files within a .BAT file

I follo

4条回答
  •  不知归路
    2021-01-05 18:45

    Whenever I have batch files that depend on another I either: 1. nest them; meaning, if batch1 needs to run before batch2, then I add batch2 within batch1. 2. put a 'sleep' call within batch2. This is only possible if you are fairly certain of the startup duration for batch1.

    A sample sleep command is:

    ping 127.0.0.1 -n 4 > null

    This will make the batch file wait for 3 seconds. (Because there are only 3, 1 second sleeps, between each of the 4 echos)

    Examples:

    start cmd /k CALL D:\jboss-5.1.0.GA-jdk6\jboss-5.1.0.GA\bin\run.bat
    ping 127.0.0.1 -n 4 > null
    start cmd /k CALL batch1.bat
    ping 127.0.0.1 -n 4 > null
    start cmd /k CALL batch2.bat
    ping 127.0.0.1 -n 4 > null
    start cmd /k CALL batch3.bat
    

提交回复
热议问题