Use Write-Progress to Return Feedback

by Apr 30, 2010

Some operations will take more time so it is a good idea to return feedback. Write-Progress can do just that. Go ahead and add a Foreach-Object to your pipeline, update the progress information with it, and remember to return the data received by Foreach-Object to the following pipeline command:

Dir $env:windir *.log -recurse -ea SilentlyContinue |
Foreach-Object { Write-Progress "Collecting…" $_$_ } |
Sort-Object Length

Twitter This Tip! ReTweet this Tip!