#PSTip PowerShell command-line switch shortcuts

Note: This tip requires PowerShell 2.0 or above.

Windows PowerShell allows you to create short names for commands using Aliases. It even allows you to specify short parameter names. Powershell.exe and powershell_ise.exe also have a set of switches to allow you to customize the session of each one, and some of them support short names. The following tables lists those switches and their short version(s) (some have more than one). Note that only switches that have shortcuts are listed.

PowerShell.exe

Parameter Shortcut(s)
Command c
EncodedArguments ea,encodeda
EncodedCommand e,ec
ExecutionPolicy ex,ep
File f
Help -h,-? or /h,/?
InputFormat i,if
NoExit noe
NoLogo nol
NoProfile nop
NonInteractive noni
OutputFormat o,of
Sta s
WindowStyle w

powershell_ise.exe

Parameter Shortcut(s)
File f
Help -h,-? or /h,/?
Mta m
NoProfile n

About the author: Shay Levy

Shay Levy is a Co-founder and editor of the PowerShell Magazine. He is a multiple-year recipient of the Microsoft MVP award, and a Microsoft Certified Trainer (MCT). Shay often covers PowerShell related topics on his blog and you can also follow him on Twitter at @ShayLevy

Related Posts

%d bloggers like this: