PowerShell aliases (via: Top Ten PowerShell Aliases for DOS Commands)
Posted by jpluimers on 2014/02/26
In most programming environments, I tend to avoid abbreviations, especially since command-completion and parameter-completion makes it easier to write readable code.
Same fore PowerShell: the PowerShell ISE has great completion features.
Other people tend to use abbreviations, especially since many PowerShell aliases make it easier for people coming from a cmd or bash background.
Two Get-Alias commands I use quite often for researching aliases:
Get-Alias -Definition <name>
Get-Alias | Sort-Object Definition
The former gives you the CmdLet for an alias.
The latter all defines alises sorted by the CmdLet definition.
Two aliases that I tend to avoid are these:
- percent sign (
%
) alias forForEach-Object
(I tend to write that full, or useforeach
) - question mark (
?
) alias forWhere-Object
(again: either full, orwhere
)
While you are at it, there are also parameter aliases. Read Weekend Scripter: Discovering PowerShell Cmdlet Parameter Aliases on TechNet Blogs to learn more about these.
–jeroen
Leave a Reply