Start-Sleep

Suspend shell, script, or runspace activity for a specified period of time.

Syntax
      Start-Sleep [-seconds] int [CommonParameters]

      Start-Sleep -milliseconds int [CommonParameters]
Key
   -seconds int
       How long to sleep, can be abbreviated to -s
       {can be piped}

   -milliseconds int
       How long to sleep in Milliseconds, can be abbreviated as -m

Standard Aliases for Start-Sleep: sleep

Example

Sleep for 60 seconds:

PS C:\> Start-Sleep -s 60

An alternative is to pause execution until the user presses a key. This can be done with the following:

PS C:\> $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")|out-null

“Many things--such as loving, going to sleep, or behaving unaffectedly--are done worst when we try hardest to do them” ~ C.S. Lewis

Related PowerShell Cmdlets:

Equivalent bash command: sleep - Delay for a specified time


 
Copyright © 1999-2020 SS64.com
Some rights reserved