Learn about Windows PowerShell
Summary: Beginner Event 10 in 2011 Scripting Games uses Windows PowerShell to determine the amount of time a command takes to complete.
About this event
Date of Event
4/15/2011 12:01 AM
4/22/2011 12:01 AM
Your boss is working on a script that needs to halt execution for five seconds and then check a specific value. In the course of writing the script, your boss became concerned about the accuracy of using the Start-Sleep Windows PowerShell cmdlet to halt execution for five seconds. The script is not going to be used to control a space probe to mars, but it should be more accurate than a traditional egg timer. To be assured of the accuracy of the Start-Sleep command, your boss asks that you measure the time the Start-Sleep command takes to pause for five seconds. To check for variation, your boss wants you to take five measurements and provide the average time in milliseconds. A satisfactory output could be as simple as seen here.
Average time of 5 runs of 5 seconds is 5007.84288 milliseconds
2011 Scripting Games: All Links on One Page
Submit your scripts on PoshCode
Support our Sponsors!
I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at email@example.com, or post your questions on the Official Scripting Guys Forum. Good luck as you compete in this year’s Scripting Games. We wish you well.
Ed Wilson, Microsoft Scripting Guy