3

#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

Filed in: Columns, Tips and Tricks Tags: , , ,

3 Responses to "#PSTip PowerShell command-line switch shortcuts"

Leave a Reply

Submit Comment

© 2016 PowerShell Magazine. All rights reserved. XHTML / CSS Valid.
Proudly designed by Theme Junkie.
%d bloggers like this: