Start-Sleep
Suspends the activity in a script or session for the specified period of time.
语法
Seconds (默认值)
Start-Sleep
[-Seconds] <Int32>
[<CommonParameters>]
Milliseconds
Start-Sleep
-Milliseconds <Int32>
[<CommonParameters>]
说明
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.
示例
Example 1: Sleep all commands for 15 seconds
Start-Sleep -s 15
This command makes all commands in the session sleep for 15 seconds.
Example 2: Sleep all commands
Start-Sleep -m 500
This command makes all the commands in the session sleep for one-half of a second (500 milliseconds).
参数
-Milliseconds
Specifies how long the resource sleeps in milliseconds. The parameter can be abbreviated as m.
参数属性
类型: | Int32 |
默认值: | None |
支持通配符: | False |
不显示: | False |
别名: | ms |
参数集
Milliseconds
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
-Seconds
Specifies how long the resource sleeps in seconds. You can omit the parameter name (Seconds), or you can abbreviate it as s.
参数属性
类型: | Int32 |
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
Seconds
Position: | 0 |
必需: | True |
来自管道的值: | True |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | 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.
输入
Int32
You can pipe the number of seconds to Start-Sleep
.
输出
None
This cmdlet does not return any output.
备注
- You can also refer to
Start-Sleep
by its built-in alias,sleep
. For more information, see about_Aliases. Ctrl+C
breaks out ofStart-Sleep
.Ctrl+C
does not break out of[Threading.Thread]::Sleep
. For more information, see Thread.Sleep Method.