Playing with PowerShell

While I signed up for the original Monad public beta, I neverreally gave it more than a cursory look: It seemed reallyincomplete and unpolished. It also irked me somewhat that Microsoftcouldn’t just embrace one of the existing scripting languages– say python or perl — even if they were inventedelsewhere, but had to go and invent something new (although I’vegrudgingly come to appreciate their reasoning).

In mid-October it came out in release form, having been renamed PowerShell.

I’ve finally got a chance to try to incorporate it, and thus farit looks very nice. While this isn’t something that you’re going tobuild a product upon, good automation scripts areinstrumental in good development practices,eliminating inefficiency, and the morale-suckage that goes alongwith repetitive, manual tasks, but more importantly eliminating theinevitable error when people are givensuch tasks.

It’s well worth a close look for automation scripts on theWindows platform. Certainly beats .bat.

Reading through the documentation, however, the following gave me a goodchuckle.

One major advantage of using objects is that it makes it mucheasier to pipeline command, that is, to pass the output of onecommand to another command as input…

…Windows PowerShell provides a new interactive model that isbased on objects, rather than text…

…In the following example, the result of an IpConfig commandis passed to a Findstr command. The pipeline operator (|) sends theresult of the command on its left to the command on its right. InMicrosoft® Windows® PowerShell, you don’t need to manipulatestrings or calculate data offsets…

PS> ipconfig | findstr “Address”

Ah…good stuff.

Of course in that case the vaunted example isn’t using objects(well I suppose the result is a set of string objects, but theexample makes no use of them, and completely fails to convince asto the difference), it’s just using the stdout of ipconfig, andthat command of course works in a classic cmd.exe (or evencommand.com) session.

Of course some people are surprized that Windows has any commandline functionality. In the examples for PureJPEG