Start-Sleep
Pause for N seconds
Start-Sleep -Seconds 5
- Works on
- WindowsLinuxmacOS
- PowerShell
- 5.1 and later
- Reference
- Microsoft Learn: Start-Sleep
- PowerShell 7 On Linux and macOS, sleep runs the system command instead of this cmdlet. Type the full cmdlet name there.
Blocks the session. -Seconds or -Milliseconds. Use it in loops so you do not hammer a host.
Try this
'before'; Start-Sleep -Seconds 2; 'after'
Coming from another shell
| Shell | What you might type |
|---|---|
| bash / zsh | sleep 5 |
| cmd.exe | timeout /t 5 |
More in From bash and From cmd.