Featured Post

Slide Deck for Lansing Day of .Net

For those that attended my session yesterday, a big thanks.  I appreciate you taking time out of your day to attend the event.  I know after living in Michigan for years that beautiful summer days are scarce and the fact you gave one up to attend a one day event is incredible. Here are the links for...

Read More

PowerShell – Speak Number of Lines of Code

Posted by Keith Elder | Posted in PowerShell | Posted on 26-02-2010

0

Ok, this is a total trivial post using PowerShell but it just shows some of the crazy fun things one can do with PowerShell.  Here is what this does. It uses the speech APIs in Windows to speak the number of lines of code found in a folder.

$speak = new-object -com “SAPI.SPVOICE”
$x = (dir -Include *.cs, *.aspx -Recurse | Select-String .).Count
$speak.Speak($x)

Of course if you just want the number of lines of code then just run the line in the middle.  But you have to admit, it isn’t near as fun!

NOTE: I am no PowerShell expert, please use the above code at your own risk!