Powershell Command : Get-Alias

Get-Alias :

Used to get the aliases for the specific command.

Get-Alias Description :

The Get-Alias cmdlet is used to get the aliases(alternate names for executable files and commands) for the current session. While trying to get the aliases in the current sessionit will also includes the bulilt-in aliases. You can also import the aliases that you need to set and this can be done with the help of Set-Alias cmdlet.

Get-Alias Syntax :

Parameter Set: Default
Get-Alias [[-Name] <String[]> ] [-Exclude <String[]> ] [-Scope <String> ] [ <CommonParameters>]

Parameter Set: Definition
Get-Alias [-Definition <String[]> ] [-Exclude <String[]> ] [-Scope <String> ] [ <CommonParameters>]

Get-Alias Parameters :

-Definition<String[]>

It was used to get the aliases for the specified item.

-Exclude <string[]>

It was used for excluding specific items.

-Scope<String>

Used to get the aliases in specified scope. Valid values are “Global”, “Local”, or “Script”, or a number relative to the current scope.

-Name<String[]>

It was used to specify the aliases which we need to retrieve. Here we can use the wildcard characters. (“Name”) is optional.

CommonParameters:

-Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, -OutVariable.

Get-Alias Examples :

1) Used to get the aliases.

PS C:> Get-Alias

2) Gets the aliases that starts with the letters g & s which will omit the “Get-” cmdlets.

PS C:> Get-Alias -Name g*, s* -Exclude Get-*

3) It will get the alias for the Get-ChildItem cmdlet.

PS C:> Get-Alias -Definition Get-ChildItem

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *