Get-Syntax
2 minute read
Get-Syntax
SYNOPSIS
Displays the syntax of a cmdlet.
SYNTAX
Get-Syntax [-CmdletName] <String> [-Markdown] [<CommonParameters>]
DESCRIPTION
The cmdlet is similar to the output you get from Get-Command -Syntax
. By default, the syntax information is returned as an object. You can also return it as formatted Markdown source that can be easily pasted into a cmdlet Markdown file.
EXAMPLES
Example 1 - Get the syntax of a command as Markdown text
Get-Syntax Get-Command -Markdown
### CmdletSet (Default)
```
Get-Command [[-ArgumentList] <Object[]>] [-Verb <string[]>] [-Noun <string[]>]
[-Module <string[]>] [-FullyQualifiedModule <ModuleSpecification[]>] [-TotalCount <int>]
[-Syntax] [-ShowCommandInfo] [-All] [-ListImported] [-ParameterName <string[]>]
[-ParameterType <PSTypeName[]>]
```
### AllCommandSet
```
Get-Command [[-Name] <string[]>] [[-ArgumentList] <Object[]>] [-Module <string[]>]
[-FullyQualifiedModule <ModuleSpecification[]>] [-CommandType <CommandTypes>] [-TotalCount <int>]
[-Syntax] [-ShowCommandInfo] [-All] [-ListImported] [-ParameterName <string[]>]
[-ParameterType <PSTypeName[]>] [-UseFuzzyMatching] [-UseAbbreviationExpansion]
```
Example 2 - Get the syntax of a command as an object
Get-Syntax Get-Command | Format-Table -Wrap
Cmdlet ParameterSetName IsDefault Parameters
------ ---------------- --------- ----------
Get-Command CmdletSet True [[-ArgumentList] <Object[]>] [-Verb <string[]>] [-Noun <string[]>] [-Module
<string[]>] [-FullyQualifiedModule <ModuleSpecification[]>] [-TotalCount <int>]
[-Syntax] [-ShowCommandInfo] [-All] [-ListImported] [-ParameterName <string[]>]
[-ParameterType <PSTypeName[]>] [<CommonParameters>]
Get-Command AllCommandSet False [[-Name] <string[]>] [[-ArgumentList] <Object[]>] [-Module <string[]>]
[-FullyQualifiedModule <ModuleSpecification[]>] [-CommandType <CommandTypes>]
[-TotalCount <int>] [-Syntax] [-ShowCommandInfo] [-All] [-ListImported]
[-ParameterName <string[]>] [-ParameterType <PSTypeName[]>] [-UseFuzzyMatching]
[-UseAbbreviationExpansion] [<CommonParameters>]
PARAMETERS
-CmdletName
The name of the cmdlet for which you want syntax information.
Type: System.String
Parameter Sets: (All)
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Markdown
Outputs the syntax information as formatted Markdown. The Markdown is suitable for updating the
syntax blocks in a cmdlet.md
file.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
COMMONPARAMETERS
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS
None
OUTPUTS
System.Object
NOTES
RELATED LINKS
Last modified March 17, 2023: (MAINT) Conform ModuleAuthor module (83e7de5)