Search code examples
batch-filecommand-linecommand-promptwindows-shell

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


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?


Solution

  • Simple use the Start /WAIT parameter.

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