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

   CommonParameters:
       -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable,
       -OutBuffer -OutVariable.

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 © SS64.com 1999-2019
Some rights reserved