Finding Hidden Parameter Shortcuts

by Nov 3, 2009

Many cmdlet parameters have built-in alias names that you can use instead of the full parameter name. So instead of "dir -ErrorAction SilentlyContinue," you could use the shortcut "ea" like this: "dir -ea SilentlyContinue."

If you need to find out the shortcut names for cmdlet parameters, use this line and replace Get-Childitem with the cmdlet you would like to investigate:

Get-Command Get-Childitem |
Select-Object -expand ParameterSets |
Foreach-Object { $_.Parameters} |
Where-Object { $_.Aliases -ne $null } |
Select-Object Name, Aliases -Unique |
Sort-Object Name
Name Aliases
—- ——-
Debug {db}
ErrorAction {ea}
ErrorVariable {ev}
LiteralPath {PSPath}
OutBuffer {ob}
OutVariable {ov}
Verbose {vb}

Twitter This Tip! ReTweet this Tip!