Average Rating:

2.50 by 3 users.

19 Downloads, 76 Views

1 Comment(s)

BeginnerEvent10.ps1

By: ScriptingWife 21 Apr 2011 04:30 PM UTC in the category: Beginner Event 10

Description:

My submission for beginner event 10.
$seconds = 5
$time = $null
$maxRun = 5
for($i = 1; $i -le $maxRun; $i++)
 {
  $time +=(Measure-Command { Start-Sleep -Seconds $seconds }).TotalMilliseconds
 }
"Average time of {0} runs of {1} seconds is {2} milliseconds" `
  -f $seconds, $maxRun, ($time / $maxRun)
Top

Comments:

4/21/2011 9:04 PM
Good use of powershell formatting operator.. I would have liked to have seen a function that accepts variable input, to make it easier to change the input parameters.

A little more documentation would have been nice as well :)