Waiting in PowerShell for all child processes to finish
And don't forget about probably the most straight forward way to do this for mulitple processes - Wait-Process
e.g.:
$procs = $(Start-Process Notepad.exe -PassThru; Start-Process Calc.exe -PassThru)$procs | Wait-Process
Did you check the background jobs feature in PowerShell v2?
$job = Start-Job -Name "Proc1" -ScriptBlock { Sleep 10000 }Wait-Job -Job $job
Also, Start-Process has a parameter called -wait. When specified, Start-Process will wait for the child to exit.
Start-Process -FilePath calc.exe -Wait