IPCONFIG/All

IPCONFIG/All

  • Comments 13

While using CMD.exe, I got into a number of bad habits. One of those is the habit of eliminating whitespace for various commands. The problem is that that causes problems with PowerShell. More precisely stated – it doesn't work. Here is what you get:

PS> ipconfig/all
The term 'ipconfig/all' is not recognized as a cmdlet, function, operable p
rogram, or script file. Verify the term and try again.
At line:1 char:12
+ ipconfig/all <<<<
PS>

In PowerShell, you have to put a space to separate the command name and the parameter (.e.g. ipconfig /all )

I know that and yet time and time again, I type it incorrectly. It is just burned into my head. After having tried to reprogram my brain, I've finally given up, accepted my weaknesses and done the following:

PS> function ipconfig/all { ipconfig /all }
PS> ipconfig/all

Windows IP Configuration

Host Name . . . . . . . . . . . . : jpsdesk10
Primary Dns Suffix . . . . . . . : ntdev.corp.microsoft.com
..

I put this in my profile so it is always available. I'm still a flawed person, but now I'm a productive flawed person. J

Enjoy!

Jeffrey Snover [MSFT]
Windows PowerShell/Aspen Architect
Visit the Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShell|
Visit the Windows PowerShell ScriptCenter at: http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx

Leave a Comment
  • Please add 8 and 3 and type the answer here:
  • Post
  • This reminds me of this little but useful function named "cd.."(uhm i think it was Mow who has mentioned this) which people tend to mistype for "cd .."

    function cd.. { cd .. }

    That simple little function saves a few key strokes during a quick and dirty navigations.

    But most of times, I ".." to move up to the parent container, I have created an alias ".." for "cd.."(well creating "function .. { cd .. }" complained that I needed to supply a name so ended up setting ".." as an alias)

    Those two small additions did make differences in productivity ;)

  • I'm glad that PS grammar doesn't get hung up on punctuation etc in function and alias names.... makes for a far more expressive experience.

    I've recently started putting question marks at the end of function names where the intent is to check something, eg:

    function alldone? { ... }

    btw Jeffrey, the fixed width stuff in this post is now fixed width for me too (sans Lucida Console)!

  • I have to admit that I am still waffling between treating powershell as a very old school shell (csh) like environment or as a programming environment like I would with new school (Python) scripting languages.

    I might go with the following syntax is more of the latter:

    &"ipconfig.exe"("/all")

  • Does PowerShell eventually make you feel snobbish about having to condescend to use those old Windows cmd-line utilities? ;-) Despite never having a need for such a thing, I think I would quickly be irked that ipconfig can't put the IPs of my adapters in a nice Excel table!

  • Same thing with cd.. to go up one folder level

  • What would be nice is if PowerShell had a concept of unhandled exception for the command line. I.e. a piece of script that is called anytime powershell can't figure out what to run (maybe there are other instances where this would be useful as well). This would allow someone to code up a generic "trap handler" that figures out: hey the user seems to have forgotten to put in spaces, let me prepend the "/"'s with spaces and see if the command works.

  • It would be even more productive with alias.

    set-alias ip ipconfig/all

  • > I might go with the following syntax is more of the latter:

    >

    > &"ipconfig.exe"("/all")

    OMG!  :-)

    Jeffrey Snover [MSFT]

    Windows PowerShell/MMC Architect

    Visit the Windows PowerShell Team blog at:    http://blogs.msdn.com/PowerShell

    Visit the Windows PowerShell ScriptCenter at:  http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx

  • > What would be nice is if PowerShell had a concept of unhandled exception for the command line. I.e. a piece of script that is called anytime powershell can't figure out what to run (maybe there are other instances where this would be useful as well). This would allow someone to code up a generic "trap handler" that figures out: hey the user seems to have forgotten to put in spaces, let me prepend the "/"'s with spaces and see if the command works.

    Please file a feature request on this.  Instructions for how to do this can be found at: http://blogs.msdn.com/powershell/archive/2006/05/09/filing-bugs.aspx .  

    Jeffrey Snover [MSFT]

    Windows PowerShell/MMC Architect

    Visit the Windows PowerShell Team blog at:    http://blogs.msdn.com/PowerShell

    Visit the Windows PowerShell ScriptCenter at:  http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx

  • Is their a powershell forum anywhere? I found a longhorn related one on technet, which seems outdated.  Is their an "official" forum anywhere, where I can ask a cmdlet question?

    Please.

    Pretty please.

  • > Is their a powershell forum anywhere?

    The newsgroup is the best place to ask questions:  Microsoft.Public.Windows.PowerShell

    Jeffrey Snover [MSFT]

    Windows PowerShell/MMC Architect

    Visit the Windows PowerShell Team blog at:    http://blogs.msdn.com/PowerShell

    Visit the Windows PowerShell ScriptCenter at:  http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx

  • Hello Jeffrey,

    I really appreciate the powershell team blog, however MSFT seems to get more and more inconsistent. Recently they propagated to move all newsgroups to forums.msdn.com and that's also where I would expect a dedicated forum about powershell. However now I have to hear that THE future base for nearly any admin guy in the MSFT world will be supported via a newsgroup again ? Pls wake up some people @msdn to get their act together. Better sooner than later.

  • I'M JUST TRYING TO FIND WEP KEY

Page 1 of 1 (13 items)