Step 2: Type old-fashioned Windows commands
You’d be amazed how much Windows command-line syntax works as expected in PowerShell.
cd changes directories (aka folders), and
dir still lists all the files and folders included in the current folder.
Depending on how you start the PowerShell console, you may start at
c:\Windows\system32 or at
c:\Users\<username>. In the screenshot example, I use
cd .. (note the space) to move up one level at a time, then run
dir to list all files and subfolders in the
Step 3: Install the help files
dir aren’t native PowerShell commands. They’re aliases -- substitutes for real PowerShell commands. Aliases can be handy for those of us with finger memory that’s hard to overcome. But they don’t even begin to touch the most important parts of PowerShell.
To start getting a feel for PowerShell itself, type
help followed by a command you know. For example, in the screenshot, I type
PowerShell help tells me that
dir is an alias for the PowerShell command
Get-ChildItem. Sure enough, if you type
get-childitem at the
PS C:\> prompt, you see exactly what you saw with the
As noted at the bottom of the screenshot, help files for PowerShell aren’t installed automatically. To retrieve them (you do want to get them), log on to PowerShell in Administrator mode, then type
update-help. Installing the help files will take several minutes, and you may be missing a few modules -- Help for NetWNV and SecureBoot failed to install on my test machine. But when you’re done, the full help system will be at your beck and call.
From that point on, type
get-help followed by the command (“cmdlet” in PowerShell speak, pronounced “command-let”) that concerns you and see all of the help for that item. For example,
get-help get-childitem produces a summary of the
get-childitem options. It also prompts you to type in variations on the theme. Thus, the following:
get-help get-childitem -examples
produces seven detailed examples of how to use
get-childitem. The PowerShell command
get-help get-childitem -detailed
includes those seven examples, as well as a detailed explanation of every parameter available for the
Step 4: Get help on the parameters
help dir screenshot, you might have noticed there are two listings under
get-childitem. The fact that there are two separate syntaxes for the cmdlet means there are two ways of running the cmdlet. How do you keep the syntaxes separate -- and what do the parameters mean? The answer’s easy, if you know the trick.
Sign up for CIO Asia eNewsletters.