Monday, March 14, 2016

Wait-Job, how nice

A few posts ago I had a bit of a tacky way to wait until a job is done:

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!

1 comment:

  1. Vint Ceramic Art | TITNIA & TECHNOLOGY
    Explore septcasino an all new “Vint Ceramic Art” project on TITNIA & TECHNOLOGY. Our titanium flat iron team of sculptors and artists have created new and