Get-CmdletXref

Get-CmdletXref

SYNOPSIS

Gets a cross-reference link for a command.

SYNTAX

Get-CmdletXref [-Name] <System.String[]> [<CommonParameters>]

DESCRIPTION

Outputs a Learn platform cross-reference hyperlink for a command in Markdown syntax. The command can be an alias, the name of a proxy command, or the name of a cmdlet published in a module. The module must be installed on the local system.

EXAMPLES

Get-CmdletXref Get-Command, Get-Help
[Get-Command](xref:Microsoft.PowerShell.Core.Get-Command)
[Get-Help](xref:Microsoft.PowerShell.Core.Get-Help)

Example 2: Pipe multiple commands to Get-CmdletXref

In this example, oss and help are proxy commands for the Out-String and Get-Help cmdlets.

'oss','help','gcm', 'git', 'foo' | Get-CmdletXref -Verbose
[Out-String](xref:Microsoft.PowerShell.Utility.Out-String)
[Get-Help](xref:Microsoft.PowerShell.Core.Get-Help)
VERBOSE: gcm is an alias for Get-Command
[Get-Command](xref:Microsoft.PowerShell.Core.Get-Command)
VERBOSE: git.exe is a(n) Application
WARNING: Unable to find command foo

The cross-reference links for successfully resolved commands are written to the Success output stream.

Example 3: Pipe results to the clipboard

In this example, oss and help are proxy commands for the Out-String and Get-Help cmdlets.

'oss','help','gcm', 'git', 'foo' | Get-CmdletXref -Verbose | Set-Clipboard
VERBOSE: gcm is an alias for Get-Command
VERBOSE: git.exe is a(n) Application
WARNING: Unable to find command foo

The cross-reference links for successfully resolved commands are written to the Success output stream and copied to the clipboard.

PARAMETERS

-Name

The name of the command to get a cross-reference link for.

Type: System.String[]
Parameter Sets: (All)
Aliases:
Accepted values:

Required: True (All) False (None)
Position: 0
Default value:
Accept pipeline input: True
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.

OUTPUTS

System.String[]

The cmdlet returns an array of strings, each representing a Markdown link using the Microsoft Learn platform xref syntax. Each link uses the command name for the link text and the xref string for the link URI.

NOTES

Last modified September 18, 2023: Remove unsupported metadata (dc2ee72)