Waiting until a process created by calling a batch file has completed

barak manos picture barak manos · Dec 2, 2013 · Viewed 22.7k times · Source

MyFile1.bat invokes MyFile2.bat twice:

start MyFile2.bat argA, argB, argC
start MyFile2.bat argX, argY, argZ

At this point, how can I wait until both processes spawned by the calls to MyFile2.bat have completed?

Answer

Knuckle-Dragger picture Knuckle-Dragger · Dec 13, 2013

Simple use the Start /WAIT parameter.

start /wait MyFile2.bat argA, argB, argC
start /wait MyFile2.bat argX, argY, argZ