PowerShell is a cross-platform task automation and configuration management framework, consisting of a command-line shell and scripting language. Unlike most shells, which accept and return text, PowerShell is built on top of the .NET Common Language Runtime (CLR), and accepts and returns .NET objects. This fundamental change brings entirely new tools and methods for automation.
Output is object-based
Unlike traditional command-line interfaces, PowerShell cmdlets are designed to deal with objects. An object is structured information that is more than just the string of characters appearing on the screen. Command output always carries extra information that you can use if you need it.
If you’ve used text-processing tools to process data in the past, you’ll find that they behave differently when used in PowerShell. In most cases, you don’t need text-processing tools to extract specific information. You directly access portions of the data using standard PowerShell object syntax.
The command family is extensible
Interfaces such as
cmd.exe don’t provide a way for you to directly extend the built-in command set. You can create external command-line tools that run in
cmd.exe. But these external tools don’t have services, such as Help integration.
cmd.exe doesn’t automatically know that these external tools are valid commands.
The commands in PowerShell are known as cmdlets. You can use each cmdlet separately, but their power is realized when you combine them to perform complex tasks. Like many shells, PowerShell gives you access to the file system on the computer. PowerShell providers enable you to access other data stores, such as the registry and the certificate stores, as easily as you access the file system.
You can create your own cmdlet and function modules using compiled code or scripts. Modules can add cmdlets and providers to the shell. PowerShell also supports scripts that are analogous to UNIX shell scripts and
cmd.exe batch files.
Support for command aliases
PowerShell supports aliases to refer to commands by alternate names. Aliasing allows users with experience in other shells to use common command names that they already know for similar operations in PowerShell.
Aliasing associates a new name with another command. For example, PowerShell has an internal function named
Clear-Host that clears the output window. You can type either the
clear alias at a command prompt. PowerShell interprets these aliases and runs the
This feature helps users to learn PowerShell. First, most
cmd.exe and Unix users have a large repertoire of commands that users already know by name. The PowerShell equivalents may not produce identical results. However, the results are close enough that users can do work without knowing the PowerShell command name. “Muscle memory” is another major source of frustration when learning a new command shell. If you have used
cmd.exe for years, you might reflexively type the
cls command to clear the screen. Without the alias for
Clear-Host, you receive an error message and won’t know what to do to clear the output.
PowerShell handles console input and display
When you type a command, PowerShell always processes the command-line input directly. PowerShell also formats the output that you see on the screen. This difference is significant because it reduces the work required of each cmdlet. It ensures that you can always do things the same way with any cmdlet. Cmdlet developers don’t need to write code to parse the command-line arguments or format the output.
Traditional command-line tools have their own schemes for requesting and displaying Help. Some command-line tools use
/? to trigger the Help display; others use
/H, or even
//. Some will display Help in a GUI window, rather than in the console display. If you use the wrong parameter, the tool might ignore what you typed and begin executing a task automatically. Since PowerShell automatically parses and processes the command line, the
-? parameter always means “show me Help for this command”.