Running Commands in the Background

by Nov 5, 2010

You can also transfer commands into another PowerShell session and run it in the background. This will find all log files recursively in your Windows folder and all of its sub-folders as background job:

$job = Start-Job { Dir $env:windir *.log -recurse -ErrorAction SilentlyContinue}

To check the status of your job, you can check the $job variable:

$job

To retrieve the collected results from your background job, you can use Receive-Job:

Receive-Job $job

Twitter This Tip!
ReTweet this Tip!