WindowsWindows Loving ItLoving It

[WORKING]PowerShell Sleep -s 5 | (5 seconds) | Shortest Syntax

Shortest Syntax for PowerShell sleep that we can use in 2020. It is easy and less than a minute to use. Short syntax for PowerShell sleep loop also.

powershell sleep

We will have a quick look at the PowerShell start-sleep command let.  It is used to pause the thread for a specified time.  It is very useful in many situations and we use it in several of our tutorials on PowerShell.

This command let has an alias called sleep which is very useful.

In this post, we are going to see PowerSleep and few examples.

The PowerShell sleep is a simple command let as it has only two switches.  The first switch is for seconds and the second switch is for milliseconds.

We can pass the number of seconds to the sleep switch as shown below.

start-sleep -seconds 5

PowerShell start sleep

We can use the sleep alias for the above command as shown below.

sleep -s 5

sleep alias

Clearly the alias makes it easy for us to use the command.

Next we will move on to using the millisecond switch.  We can use the millisecond switch.

start-sleep -Milliseconds 5000

sleep in milliseconds

The milliseconds switch can be used with alias also as shown below.

sleep -m 5000

milli seconds alias

Using the start-sleep with the alias for a millisecond helps us use the script easily.

The following script will show us how the start-sleep interferes with the execution of the code.

while($i -lt 5){
sleep -s 2
write-host $i
$i = $i+1

PowerShell sleep loop

The above script will show the list of numbers instantaneously in a script that does not have the start-sleep option.  Since we are using the start-sleep command let, we are able to write the numbers to the shell one after another after some delay.


In this post, we learned some of the least appreciated command lets called the start-sleep.  The start-sleep command let can be replaced with the alias sleep.  The start-sleep has two switches, one accepts the seconds of delay and another one accepts the milliseconds. Finally, we saw the use of the start-sleep on the loop to display a list of numbers.

If you want more awesome posts, stay tuned to TecKangaroo.

PowerShell Sleep
  • Article Rating
  • Content Relevance
  • Content Clarity
  • Author Rating

Leave a Reply

Your email address will not be published. Required fields are marked *