Wednesday, May 13, 2015

#71 : Pause a Powershell Script

Sometimes, we need to pause scripting where any asynchronous operation is in progress or we have to wait for some file to appear. In all such cases, Start-Sleep can help you achieve that. Let's take a look into syntax and then we will use the same in our example :

Syntax:
Start-Sleep -Milliseconds <int> [<CommonParameters>]
Start-Sleep [-Seconds] <int> [<CommonParameters>]


Example:
Pause the script for 5 seconds:
Start-Sleep -Seconds 5

 

No comments:

Post a Comment

#112: How to handle xml document in Powershell?

 In PowerShell, you can handle XML data using various cmdlets and methods provided by the .NET Framework. Here's a basic guide on how to...