Skip to content

Instantly share code, notes, and snippets.

@chrdek
Created November 13, 2021 11:52
Show Gist options
  • Save chrdek/3f8aac12abed7903e8bef95744a5d090 to your computer and use it in GitHub Desktop.
Save chrdek/3f8aac12abed7903e8bef95744a5d090 to your computer and use it in GitHub Desktop.
Make a real-time progress bar using powershell. example for 2000 ms
$elapsedTime = [system.diagnostics.stopwatch]::StartNew()
# change value for other timer durations.
1..2000 | %{write-progress -activity "Working..." -status "$([string]::Format("Time Elapsed: {0:d2}:{1:d2}:{2:d2}", $elapsedTime.Elapsed.hours, $elapsedTime.Elapsed.minutes, $elapsedTime.Elapsed.seconds))" -percentcomplete ($_/10);}
$elapsedTime.stop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment