- 1 year ago
Powershell command to wait some time
In PowerShell, you can use the Start-Sleep
cmdlet to pause the execution of a script or command for a specified period of time. Here's an example:
powershell# Wait for 5 seconds
Start-Sleep -Seconds 5
# Wait for 1 minute
Start-Sleep -Seconds 60
# Wait for 2 hours
Start-Sleep -Seconds 7200
In this example, the Start-Sleep
cmdlet is used to pause the execution for a specific duration. The -Seconds
parameter is used to specify the number of seconds to wait. You can adjust the value to the desired wait time, such as waiting for 5 seconds, 1 minute (60 seconds), or 2 hours (7200 seconds).
You can also use the -Milliseconds
parameter to specify the wait time in milliseconds if you need a more granular delay.
After the specified duration has elapsed, the script or command execution will continue.
Please note that Start-Sleep
is primarily used for scripting purposes, and it may not be the best option for interactive use, as it will pause the entire PowerShell session.