Thursday, March 27, 2014

Simple PowerShell Seconds Progress Timer

Here is a simple powershell seconds timer (to display the seconds remaining) when you want to pause your script using the Start-Sleep command, and display how much time is left:

#time in seconds 
$time = 25

while($time -gt 0)
{

$text = " " + ($time % 60) + " seconds left"

Write-Progress "Sleeping For" -status $text

start-sleep -s 1

$time--

}

No comments:

Post a Comment