Running Commands

Published: May 20, 2009

Updated: August 9, 2012

Applies To: Windows PowerShell 2.0, Windows PowerShell 3.0

Windows PowerShell provides a complete interactive environment. When you type a command or expression at the Windows PowerShell command prompt, the command or expression is processed immediately and the output is returned to the prompt.

This is true for all command types, including cmdlets, aliases, functions, CIM commands, workflows, and executable files.

You can also send the output of a command to a file or printer, or you can use the pipeline operator (|) to send the output to another command.

For example, when you type a command, such a command that uses the Get-Command cmdlet, the command runs immediately and the output is returned to the command prompt.

PS C:\>Get-Command

Cmdlet          Add-BitsFile                                       BitsTransfer
Cmdlet          Add-Computer                                       Microsoft.PowerShell.Management
Cmdlet          Add-Content                                        Microsoft.PowerShell.Management
Cmdlet          Add-History                                        Microsoft.PowerShell.Core
Cmdlet          Add-JobTrigger                                     PSScheduledJob
Cmdlet          Add-Member                                         Microsoft.PowerShell.Utility
Cmdlet          Add-PSSnapin                                       Microsoft.PowerShell.Core
Cmdlet          Add-PsSpecCmdletParameter                          PsSpecCmdlets
Cmdlet          Add-PsSpecCmdletParameterSetEntry                  PsSpecCmdlets
Cmdlet          Add-PsSpecUserPermission                           PsSpecCmdlets
Cmdlet          Add-Type                                           Microsoft.PowerShell.Utility
Cmdlet          Checkpoint-Computer                                Microsoft.PowerShell.Management
Cmdlet          Clear-Content                                      Microsoft.PowerShell.Management
Cmdlet          Clear-EventLog                                     Microsoft.PowerShell.Management

You can also type an expression, such as an arithmetic expression that uses Windows PowerShell built-in converters. Again, the experience is interactive. The expression is processed immediately and the results are returned at the command prompt.

PS C:\> 7GB / 1028KB

See Also


Running Scripts

Other Resources

Running Remote Commands