Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make the batch file wait until another batch file completes execution?

Tags:

How can I make a batch file wait until another batch file has finished?

For example, I have:

echo hi >r.txt echo some piece of code >>r.txt   start ar.bat  echo some piece of code >>ar.txt  

I want the code after start ar.bat to execute only after ar.bat finishes executing. I tried without start and it works, but I want to run ar.bat in a separate window.

Is there any method to check whether ar.bat has finished?

like image 297
Arunachalam Avatar asked Apr 03 '10 18:04

Arunachalam


People also ask

How do I put a wait in a batch file?

Type in your command.TIMEOUT — Type timeout time where "time" is replaced by the number of seconds to delay. For example, typing in timeout 30 will delay your batch file for 30 seconds.

How do I put a timed pause in a batch file?

You can insert the pause command before a section of the batch file that you might not want to process. When pause suspends processing of the batch program, you can press CTRL+C and then press Y to stop the batch program.

Can you schedule batch file?

Run batch file with Task Scheduler To use Task Scheduler to run the batch file automatically at a specific time, use these steps: Open Start. Search for Task Scheduler and click the top result to open the app. Right-click the "Task Scheduler Library" branch and select the New Folder option.


1 Answers

Use call ar.bat to do it completely with batch file commands.

Use start /wait ar.bat to get another window and wait for it to complete.

like image 56
Anders Abel Avatar answered Oct 25 '22 09:10

Anders Abel