Getting Summary Command Information in Windows PowerShell

10/20/2009

The Windows PowerShell Get-Command cmdlet retrieves the names of all available commands. When you type Get-Command at a Windows PowerShell prompt, you will see output similar to the following:

PS> Get-Command

CommandType Name Definition

----------- ---- ----------

Cmdlet Add-Content Add-Content [-Path] <String[...

Cmdlet Add-History Add-History [[-InputObject] ...

Cmdlet Add-Member Add-Member [-MemberType] <PS...

...

This output looks a lot like the Help output of Cmd.exe: a tabular summary of internal commands. In the extract of the Get-Command command output shown above, every command shown has a CommandType of Cmdlet. A Cmdlet is Windows PowerShell's intrinsic command type that corresponds roughly to the dir and cd commands of Cmd.exe and to built-ins in UNIX shells such as BASH.

In the output of the Get-Command command, all of the definitions end with ellipses (...) to indicate that PowerShell cannot display all of the content in the available space. When Windows PowerShell displays output, it formats the output as text and then arranges it to make the data fit cleanly into a console window. We will talk about this later in the section on formatters.

The Get-Command cmdlet has a Syntax parameter that allows you to retrieve just the syntax of each cmdlet. Enter the Get-Command -Syntax command to display the full output:

PS> Get-Command -Syntax

Add-Content [-Path] <String[]> [-Value] <Object[]> [-PassThru] [-Filter <String>] [-Include <String[]>] [-Exclude <String[]>] [-Force] [Credential <PSCredential>] [-Verbose] [-Debug] [-ErrorAction <ActionPreference>] [-ErrorVariable <String>] [-OutVariable <String>] [-OutBuffer <Int32>] [-WhatIf] [-Confirm] [-Encoding <FileSystemCmdletProviderEncoding>]

Add-History [[-InputObject] <PSObject[]>] [-Passthru] [-Verbose] [-Debug] [-ErrorAction <ActionPreference>] [-ErrorVariable <String>] [-OutVariable <String>][-OutBuffer <Int32>]...

Posted in: Windows| Tags: Windows PowerShell PowerShell Windows cmdlets Syntax string content command cmdlet output table tbody

Hot Posts

Latest posts

Tags

Others

Sponsors