Print
Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
 

Windows PowerShell aliases are very handy. They typically have fewer characters than the commands and parameters that they represent, so they’re quicker to type and great for tweeting. However, it has long been an established best practice that aliases should not be used in blogs, in help, in examples, or in any shared scripts and commands. They create an extra layer of confusion for beginners and they’re an obstacle for anyone who needs to maintain the script.

Still, we use them. I know that, despite my best efforts, I type “dir” and “where” and “gcm” and “ipmo” and “sls”  and, worst of all, “foreach” when I mean the ForEach-Object cmdlet, not the ForEach statement.

Fortunately, some nifty features in PowerShell Studio make it easy to conform to the best practice, despite our habits.

PrimalSense recognizes aliases

 

But, when I’m scripting, I’m a bit too focused to think about aliases. Instead, when I’m done with my script, just before I sign it, I type:

CTRL + SHIFT + A

Ctrl+Shift+A converts all cmdlet and parameter aliases, and parameter partial names*, to their full names with correct capitalization. What an easy way to support a best practice.

Oh, and in case you’re wondering, PowerShell Studio is happy to undo all of your good deeds. You can right-click and click Convert to Alias or type Ctrl+Shift+Alt+A to convert all cmdlet and parameter names to aliases.

 

* A few notes:

 

June Blender is a technology evangelist at SAPIEN Technologies, Inc. You can reach her at This email address is being protected from spambots. You need JavaScript enabled to view it. or follow her on Twitter at @juneb_get_help.

If you have questions about our products, please post in our support forum.
For licensed customers, use the forum associated with your product in our Product Support Forums for Registered Customers.
For users of trial versions, please post in our Former and Future Customers - Questions forum.