Get-Alias

Return alias names for Cmdlets

Syntax
      Get-Alias [ [-name] string[] ]
         [-scope string] [-exclude string[] ]
            [CommonParameters]
Key
    -name string[]
        The alias to retrieve. By default, all aliases defined for the current session.
        (the "-Name" is optional)

     -passThru 
        Pass the object created by this cmdlet through the pipeline. By defau
        lt, this cmdlet does not pass any objects through the pipeline.

    -scope string
        The scope in which this alias is valid. 
        Valid values are "Global", "Local", or "Script", or a number relative
        to the current scope ( 0 through the number of scopes, where 0 is the
        current scope and 1 is its parent). "Local" is the default.
        For more, type "get-help about_scope".

    -exclude string[]
        Omit the specified items, wildcards allowed e.g. "*ms*"

   CommonParameters:
       -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutVariable.

Examples

Retrieve all aliases for the current session, displaying the cmdlet and the alias name:

PS C:\>get-alias

Retrieve all aliases that start with the letter S

PS C:\>get-alias -name s*

Retrieve all aliases that reference the Set-Location cmdlet :

PS C:\>get-alias | where-object {$_.Definition -match "Set-Location"}

Retrieve all built-in aliases (these have the ReadOnly option set):

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

#There are places I remember
All my life, though some have changed# - The Beatles (In My Life)

Related Powershell Commands:

export-alias epal Export an alias list to a file
import-alias - Import an alias list from a file
new-alias - Create a new Cmdlet-alias pairing
set-alias - Map an alias to a Cmdlet



Back to the Top

Simon Sheppard
SS64.com