Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Waiting in PowerShell for all child processes to finish

I want to execute multiple external scripts in PowerShell simultaneously and then wait for all of them to finish before proceeding. Currently I am using 'start-process -NoNewWindow ...' commandlet that loops through all child processes but then terminates.

I have found many ways to wait for 1 process to finish (this is obviously trivial) but none of them seem to work as a solution for my problem.

Having an equivalent for UNIX version in PowerShell would definitely be what I am looking for.

like image 979
jaccus Avatar asked Feb 14 '11 09:02

jaccus


1 Answers

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
like image 82
Keith Hill Avatar answered Oct 16 '22 03:10

Keith Hill