You can use the Start-Sleep cmdlet to suspend the activity in a script for the specified period of time. You can use this command for the tasks, such as waiting for an operation to complete or pausing before repeating an operation.
This command wait for 5 seconds.
Start-Sleep -Seconds 5 ------- or --------- Start-Sleep -s 5
The following command makes all the commands to sleep for 500 milliseconds (half of a second)
Start-Sleep -Milliseconds 500 ------- or --------- Start-Sleep -m 500
Timer Job using the cmdlets Start-Sleep and Write-Progress:
The following command run the timer for 60 seconds (1 minute).
1..60 | ForEach { Start-Sleep -s 1 Write-Progress -activity "Timer Started: " -Status $_ }
Advertisement