Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Count a Range of Seconds with PowerShell

$
0
0

Summary: Use Windows PowerShell to count a range of seconds.

Hey, Scripting Guy! Question How can I use Windows PowerShell to count a range of seconds of increasing duration?

Hey, Scripting Guy! Answer Use the range operator to create a range of numbers, then pipe the results to the ForEach-Object cmdlet
          inside a script block call Start-Sleep:

1..5 | ForEach {Start-Sleep -Seconds $_ ; "$_ seconds"}


Viewing all articles
Browse latest Browse all 3333

Trending Articles