r/PowerShell • • Aug 18 '17

Script Sharing How To Create Progress Bars in PowerShell

https://mcpmag.com/articles/2017/08/17/create-progress-bars-in-powershell.aspx
126 Upvotes

12 comments sorted by

View all comments

6

u/[deleted] Aug 19 '17

I made an extremely useful cmdlet called Measure-Progress that makes progress bars in PowerShell dead simple. (I originally named it ForEach-Progress, but that doesn't really make any sense.) But it does function very similarly to ForEach-Object.

Get-ChildItem *.csv | Measure-Progress { DoSomethingSlow $_ }

Or instead of a ScriptBlock, just sit in the middle of a pipeline…

Get-ChildItem *.csv | Measure-Progress | DoSomethingSlow

This will show a progress bar that increments each time an input object from the pipeline is read.