Ask a questionAsk a question
 

StickyUnofficial PowerShell FAQ wiki

  • Wednesday, August 26, 2009 12:08 AMMarco ShawMVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    We are going to start creating a FAQ wiki.  The unofficial PowerShell FAQ will be hosted here:
    http://wiki.poshcode.org

    Please post your top FAQs as a reply to this post.  I can add them to the wiki and give you credit (if you want, so specify that).

    If you'd prefer not to post an FAQ here publically, please feel free to email me directly: marco DOT shaw _AT_ gmail DOT com.

    This will be YOUR wiki so help build it for other newcomers...

    Marco

All Replies

  • Saturday, September 05, 2009 11:26 AMFleet Command Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Well, let's start with basics:

    • Q: How Windows PowerShell compares with Command Prompt?
      A: Windows PowerShell is a very advanced command-line interface that can do far more beyond the capabilities of Command Prompt. For instance, whereas Command Prompt could only natively access and operate with file system, Windows PowerShell can access and operate with Registry and WMI as well. Whereas Command Prompt's only automation capability was limited to batch files, Windows PowerShell natively supports scripting and can do things that previously was only possible by creating a new Windows application.
    • Q: Do the same commands in Command Prompt operate the same way in Windows PowerShell?
      A: To tell the truth, no. Although theoretically we have shortcut commands like DIR and CD in Windows PowerShell that are meant to do the same thing in Windows PowerShell, they do operate differently.

      For instance, "CD.." just gives you an error message in Windows PowerShell. (You must type "CD .." instead.) "DIR *.*" no longer gives you a list of all files in Windows PowerShell. It only gives the list of all files that have a file extension, seperated by a dot from their name. (You must type "DIR *" instead.) "DEL." and "DEL ." no longer works in Windows PowerShell. (You must type "DEL *" instead.)

      The issue can sometimes get worse: If you want to use SC.EXE utility in Windows PowerShell to manipulate Windows Services from within Windows PowerShell, use caution: Windows PowerShell has a native SC command that does an entirely different thing. So, for instance, instead of "SC STOP WUAUSERV", you must consider using "& SC.EXE STOP WUAUSERV".

      Windows PowerShell also uses a set of entirely different command-line parameters for its commands. For example, "DIR *.exe /a /s" no longer works. You must consider using "DIR . -include *.exe -recurse -force" to get the same results.

      Last but not least, commands in Windows PowerShell operates differently. For example, you can no longer use DIR command to get the total size of files in a certain folder. It does not output this value.

      Suffice to say: If you wish to wield the power of Windows PowerShell, learn Windows PowerShell from the scratch.
    • Q: What is the escape character in Windows PowerShell?
      A: Tickback character. (')

    The greatest moment of everyone's life is the moment of positive thinking.