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 & ventureberg.com/ TECHNOLOGY. Our titanium flat iron team of sculptors and artists gri-go.com have https://febcasino.com/review/merit-casino/ created new and

    ReplyDelete