Looks like it's not an alias.
get-alias alias
error: This command cannot find a matching alias because an alias with the name 'alias' does not exist.
and it's not a command
get-command alias
error: The term 'alias' is not recognized as the name of a cmdlet, function, script file, or operable program.
Most probably alias
is an alias to get-alias
cmdlet, but where is it defined?
An alias is an alternate name for a cmdlet, function, executable file, including scripts. PowerShell includes a set of built-in aliases. You can add your own aliases to the current session and to your PowerShell profile.
PowerShell includes built-in aliases that are available in each PowerShell session. The Get-Alias cmdlet displays the aliases available in a PowerShell session. To create an alias, use the cmdlets Set-Alias or New-Alias . In PowerShell 6, to delete an alias, use the Remove-Alias cmdlet.
To create an alias for a command, create a function that includes the command, and then create an alias to the function. To save the aliases from a session and use them in a different session, add the Set-Alias * command to your Windows PowerShell profile.
For some reason, you can omit the get-
from a get-xxxx
cmdlet in PowerShell and it will add the get-
for you.
For instance, you can type hotfix
instead of get-hotfix
alias
is resolved as Get-Alias
, and here's how I found out:
> Trace-Command -Expression { alias } -Name CommandDiscovery -PSHost
DEBUG: CommandDiscovery Information: 0 : Looking up command: alias
<A rather large number of lines deleted, showing exactly where it's looking>
DEBUG: CommandDiscovery Information: 0 : Looking for alias in C:\bin\sysinternals
DEBUG: CommandDiscovery Information: 0 : The command [alias] was not found, trying again with get- prepended
DEBUG: CommandDiscovery Information: 0 : Looking up command: get-alias
DEBUG: CommandDiscovery Information: 0 : Cmdlet found: Get-Alias Microsoft.PowerShell.Commands.GetAliasCommand
<actual output of get-alias>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With