How to call one batch file after another

后端 未结 6 1967
闹比i
闹比i 2020-12-14 16:23

I have a batch file that i am testing, all i want to do is the following

CALL ping.bat

Then after that batch file has run i want to run ano

6条回答
  •  抹茶落季
    2020-12-14 16:34

    Assume you have 3 batch files.

    1. ping1.bat which has the content ping 127.0.0.1
    2. ping2.bat which has the content ping 127.0.0.1
    3. ping3.bat which has the below two lines
      call ping1.bat
      call ping2.bat

    If you have all the three batch files in a single folder,(lets say under C:\NewFolder) then if you double click ping3.bat, you won't get any error for sure.

    Note: If you don't want to wait for the first command to complete, then use start keyword which just initiate the process and proceed with the next line in the batch file, whereas call will do it sequentially(comes to next line only after the current process completes , start allows parallelism)
    To do it parallel use the below two lines of code in the ping3.bat:

    start ping1.bat
    start ping2.bat

提交回复
热议问题