While (Get-Job -State "Running") {
Write-Host -ForegroundColor Yellow "Running..."
Start-Sleep 1
}
Turns out, there is a much more elegant function to do this:
Wait-Job -State Running
or as the built in example shows:
Get-Job | Wait-Job
This command waits for all of the background jobs running in the session to complete. Nice!
No comments:
Post a Comment