views:

120

answers:

1

how to make the batch file wait until another batch file completes execution?

let me explain with an example.

echo hi >r.txt
echo some piece of code >>r.txt 

start ar.bat

echo some piece of coe >>ar.txt 

i want the code after start ar.bat to execute after this batch file exits ..

i have tried without start it works but i want to run it in a seperate window ..is there any function to check whether that window which is running ar.bat is present ?

+6  A: 

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.

Anders Abel
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).
Michael Burr
gr8 thank u ...
Arunachalam