Advertisement
mariussm

New-Progressbar - Example

Jun 7th, 2014
452
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Get a big list of files of unknown size
  2. $files = @(dir $env:SystemRoot | select -First (Get-Random -Minimum 10 -Maximum 100))
  3.  
  4. # Create progressbar
  5. $bar = New-Progressbar -TotalCount $files.Count -ActivityName "Processing files"
  6.  
  7. # Pretend to process files in order to progress the progressbar
  8. $files | foreach {
  9.     $bar.Progress($_.Name)
  10.     sleep -Milliseconds 100
  11. }
  12.  
  13. # Complete the progressbar
  14. $bar.Complete()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement