Suspends the activity in a script or session for the specified period of time.

Syntax

  Copy Code
Start-Sleep -Milliseconds <int> [<CommonParameters>]

Start-Sleep [-Seconds] <int> [<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.

Parameters

-Milliseconds <int>

Specifies how long the resource sleeps in milliseconds. The parameter can be abbreviated as "-m".

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-Seconds <int>

Specifies how long the resource sleeps in seconds. You can omit the parameter name ("Seconds"), or you can abbreviate it as "-s".

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue, ByPropertyName)

Accept Wildcard Characters?

false

<CommonParameters>

This command supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, OutBuffer, OutVariable, WarningAction, and WarningVariable. For more information, see about_CommonParameters.

Inputs and Outputs

The input type is the type of the objects that you can pipe to the cmdlet. The return type is the type of the objects that the cmdlet returns.

Inputs

System.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-Sleep by its built-in alias, "sleep". For more information, see about_Aliases.

Example 1

  Copy Code
C:\PS>Start-Sleep -s 15

Description

-----------

This command makes all commands in the session sleep for 15 seconds.

Example 2

  Copy Code
C:\PS>Start-Sleep -m 500

Description

-----------

This command makes all the commands in the session sleep for one-half of a second (500 milliseconds).