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

57,189

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.

Share:
57,189

Related videos on Youtube

Arunachalam
Author by

Arunachalam

fun

Updated on July 09, 2022

Comments

  • Arunachalam
    Arunachalam almost 2 years

    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?

  • Michael Burr
    Michael Burr about 14 years
    Use call - invoking another batch file directly (without call) won't return from the 2nd batch file (it's more of a jump than a call in that case).