PowerShell Logo Small

Get-Alias



This is the built-in help made by Microsoft for the command 'Get-Alias', in PowerShell version 2 - as retrieved from Windows version 'Microsoft® Windows Vista™ Ultimate ' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Gets the aliases for the current session.

SYNTAX


Get-Alias [[-Name] <string[]>] [-Exclude <string[]>] [-Scope <string>] [<CommonParameters>]
Get-Alias [-Definition <string[]>] [-Exclude <string[]>] [-Scope <string>] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Get-Alias cmdlet gets the aliases (alternate names for commands and executable files) in the current session. This includes built-in aliases,
aliases that you have set or imported, and aliases that you have added to your Windows PowerShell profile.

By default, Get-Alias takes an alias and returns the command name. When you use the Definition parameter, Get-Alias takes a command name and retu
rns its aliases.



<

RELATED LINKS

Online version: http://go.microsoft.com/fwlink/?LinkID=113306
about_Aliases
Set-Alias
New-Alias
Export-Alias
Import-Alias
Alias Provider



REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

C:\PS>get-alias



Description
-----------
This command gets all aliases in the current session.








-------------------------- EXAMPLE 2 --------------------------

C:\PS>get-alias -name g*, s* -exclude get-*



Description
-----------
This command gets all aliases that begin with "g" or "s", except for aliases that begin with "get-".








-------------------------- EXAMPLE 3 --------------------------

C:\PS>get-alias -definition Get-ChildItem



Description
-----------
This command gets the aliases for the Get-ChildItem cmdlet.

By default, the Get-Alias cmdlet gets the item name when you know the alias. The Definition parameter gets the alias when you know the item name.








-------------------------- EXAMPLE 4 --------------------------

C:\PS>get-alias | where-object {$_.Options -match "ReadOnly"}



Description
-----------
This command retrieves all aliases in which the value of the Options property is ReadOnly. This command provides a quick way to find the aliases
that are built into Windows PowerShell, because they have the ReadOnly option.

Options is just one property of the AliasInfo objects that Get-Alias gets. To find all properties and methods of AliasInfo objects, type "get-ali
as | get-member".








-------------------------- EXAMPLE 5 --------------------------

C:\PS>get-alias -definition "*-pssession" -exclude e* -scope global



Description
-----------
This example gets aliases for commands that have names that end in "-pssession", except for those that begin with "e".

The command uses the Scope parameter to apply the command in the global scope. This is useful in scripts when you want to get the aliases in the
session.