Friday, November 10, 2006

Windows Power Shell Coolness

I'm trying to learn the new Windows Power Shell, and I wrote my first useful little script. I used the following to count the number of source files in a directory that begin with S through Z:

$count = 0
$re = [regex]"^[S-Zs-z]"
dir *.cs | foreach { if ($_.Name -match $re) { $count++ } }
$count

I found the following O'Reilly article to be helpful in getting going with WPS.

No comments: