Nov 30, 2007

Windows PowerShell overkill

Sometimes OO paradigm is an overhead, not a savior. Especially when it comes to simple manipulations such that are typical to shell scripting tasks. I mean, what appears more to the point and is faster to implement? This:

ipconfig | findstr "Address"

Or this:

ifconfig | grep "Address"

The latter is more flexible, you can search for pretty much anything. And once you get regex involved -- opportunities are endless.

As usual, instead of conforming to POSIX, Microsoft invents its own incompatible way of doing scripting. Sure, anything would seem to be better after horrors of COMMAND.COM and CMD.EXE. But it did not have to be that bad.

Maybe (quite certainly) I am biased, having spent years in a warm comfort of bash and tcsh. But maybe I am right and PShell is just another failed MSFT experiment at "borrowing" ideas from others...

1 comment:

  1. Anonymous20:22

    I think what you want is:

    (ipconfig) -match "address"

    Match takes a regular expression so you can party to your hearts content.

    Alternatively you can use simple wildcarding with -LIKE:

    (ipconfig) -like "*addr*"

    You can also use Select-String which takes a regular expression (which I always alias to "SS" and we'll ship that alias in V2).

    ipconfig |ss address

    This is probably the simpliest and fastest of all the methods.

    I think we have that one covered but I really appreciate you taking the time to say where you think we suck. Please kick the tires some more and complain were we got it wrong. We worked hard but at the end of the day, it's a V1. Let us know where we got it wrong and we'll try to fix it for V2.


    Jeffrey Snover [MSFT]
    Windows Management Partner Architect
    Visit the Windows PowerShell Team blog at:
    Visit the Windows PowerShell ScriptCenter at: