Monday, February 25, 2008

2008 Scripting Games!! Beg. Event 4

Event 4 was another easy one to do in Powershell. I did however receive "0" points even though I correctly solved the event. I emailed MS to see if they could provide an answer to why this happened. I did however get my points in the VBScript category. None the less here is my solution for Event 4.

   1:  gc ($myinvocation.MyCommand.path) | Measure -Character| select characters |fl

I'm using the built in variable $myinvocation to get the whole path to the script and piping it to the measure-object cmdlet to get the count of Characters then passing that to the select cmdlet then finally to format-list.

No comments: