Start-Sleep
Suspends the activity in a script or session for the specified period of time.
Syntax
Seconds (Default)
Start-Sleep
[-Seconds] <Double>
[<CommonParameters>]
Milliseconds
Start-Sleep
-Milliseconds <Int32>
[<CommonParameters>]
Description
The Start-Sleep cmdlet suspends the activity in a script or session for the specified period of
time. You can use it for many tasks, such as waiting for an operation to complete or pausing before
repeating an operation.
Examples
Example 1: Sleep all commands for 15 seconds
Start-Sleep -s 15
Example 2: Sleep all commands for 1.5 seconds
This example makes all the commands in the session sleep for one and one-half of a seconds.
Start-Sleep -Seconds 1.5
Parameters
-Milliseconds
Specifies how long the resource sleeps in milliseconds. The parameter can be abbreviated as m.
Parameter properties
| Type: | Int32 |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | ms |
Parameter sets
Milliseconds
| Position: | Named |
| Mandatory: | True |
| Value from pipeline: | False |
| Value from pipeline by property name: | True |
| Value from remaining arguments: | False |
-Seconds
Specifies how long the resource sleeps in seconds. You can omit the parameter name or you can abbreviate it as s. Beginning in PowerShell 6.2.0, this parameter now accepts fractional values.
Parameter properties
| Type: | Double |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
Seconds
| Position: | 0 |
| Mandatory: | True |
| Value from pipeline: | True |
| Value from pipeline by property name: | True |
| Value from remaining arguments: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Inputs
Int32
You can pipe the number of seconds to Start-Sleep.
Outputs
None
This cmdlet does not return any output.
Notes
- You can also refer to
Start-Sleepby its built-in alias,sleep. For more information, see about_Aliases. Ctrl+Cbreaks out ofStart-Sleep.Ctrl+Cdoes not break out of[Threading.Thread]::Sleep. For more information, see Thread.Sleep Method.