I tried something like this and it starts one after the other
function start-parallel {
workflow work {
start-process $exe1 -wait
start-process $exe2 -wait
}
work
}
CodePudding user response:
No, you can't simultaneously wait and not wait.
What you'll want to do is save the process objects output by Start-Process -PassThru
to a variable, and then not wait until after you've kicked off all the processes:
$processes = @(
Start-Process $exe1 -PassThru
Start-Process $exe2 -PassThru
# ...
)
# now wait for all of them
$null = $processes |ForEach-Object WaitForExit