I'm trying to check an alias for a cmdlet. How could I verify this through a command?

I have been trying this way:

Get-Command -CommandType alias | Where-Object {$ _. Name-like "Copy-Item"}


There was a problem loading this image.

3 Answers 3

Get-Alias -Definition Copy-Item

Get-Help explains the use of -Definition:

Specifies an array of aliases for the specified item. Enter the name of a cmdlet, function, script, file, or executable file.

  • 4
    gal -d copy-item if you are like me, too lazy to write this whole text
    – SimonS
    Commented Aug 10, 2018 at 8:20
  • 3
    And to get the alias of an alias, gal gal
    – root
    Commented Aug 10, 2018 at 12:12

You don't want to match on Name, you want to match on Definition:

Get-Command -CommandType Alias | Where-Object {$_.Definition -like "Copy-Item"}

You can often find a lot of useful information by piping the output of a command to Get-Member.


You already have your answer, but if you ever want to check for all aliases on a system, for cmdlet/function or even a parameters of said same, here is a way to do it.

# Get all named aliases 
Get-Alias | 
Out-GridView -PassThru -Title 'Available aliases'

# Get cmdlet / function parameter aliases
(Get-Command Get-Process).Parameters.Values | 
where aliases | 
select Name, Aliases | Out-GridView -PassThru -Title 'Alias results for a given cmdlet or function.'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .