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>]
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.
예제
Example 1: Pause execution for 1 second
In this example, the execution of commands pauses for one second.
Start-Sleep -Seconds 1
Example 2: Pause execution at the command line
This example shows that execution is paused for 5 seconds when run from the command line.
PS> Get-Date; Start-Sleep -Seconds 5; Get-Date
Friday, May 13, 2022 9:38:15 AM
Friday, May 13, 2022 9:38:20 AM
PowerShell cannot execute the second Get-Date
command until the sleep timer expires.
매개 변수
-Milliseconds
Specifies how long the resource sleeps in milliseconds. The parameter can be abbreviated as m.
매개 변수 속성
형식: | Int32 |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
매개 변수 집합
Milliseconds
Position: | Named |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | True |
나머지 인수의 값: | False |
-Seconds
Specifies how long the resource sleeps in seconds. You can omit the parameter name or you can abbreviate it as s.
매개 변수 속성
형식: | Int32 |
Default value: | None |
와일드카드 지원: | False |
DontShow: | 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 this cmdlet.
출력
None
This cmdlet returns no output.
참고
Windows PowerShell includes the following aliases for Start-Sleep
:
sleep
Ctrl+C
breaks out ofStart-Sleep
.Ctrl+C
does not break out of[Threading.Thread]::Sleep
. For more information, see Thread.Sleep Method.