Progress Bar Timer

by Jul 19, 2018

Here is a simple example using the PowerShell progress bar. The code displays a progress bar counting down a break. Simply adjust the number of seconds you’d like to pause. You could use this example for displaying breaks in classes or conferences:

$seconds = 60
1..$seconds |
ForEach-Object { $percent = $_ * 100 / $seconds 

Write-Progress -Activity Break -Status "$($seconds - $_) seconds remaining..." -PercentComplete $percent 

Start-Sleep -Seconds 1
}

Twitter This Tip! ReTweet this Tip!