Pausing Scripts in PowerShell with Start-Sleep

Image Description

Daily PowerShell #24

Scripting Daily PowerShell Basics

November 9, 2021

quote Discuss this Article

The Start-Sleep cmdlet can be used to pause scripts for a specified amount of time.

Pause for Seconds

The default parameter set of Start-Sleep will pause for the number of seconds specified.

Start-Sleep 5
Start-Sleep -Seconds 5

You can also specify partial seconds.

Start-Sleep 5.5

Pause for Milliseconds

The -Milliseconds parameter can be used to specify a number of milliseconds to pause a script.

Start-Sleep -Milliseconds 500