Thursday, January 7, 2010

Custom aliases

If there is one thing missing from PowerShell it is definately aliases.  The 100+ provided in 2.0 just aren't enough.  Graciously, the folks at MS understand our pain, and have given us the ability to create custom aliases in PoSh 2.0.

ONELINER

Set-Alias se Set-ExecutionPolicy
 code: copy : expand : collapse

EXPLANATION
This creates a new alias named "se" for the CmdLet Set-ExecutionPolicy.  Very simple.  Now, substitute any alias name you would like for any CmdLet (or even scriptlet, executable,...)

NOTE
This is great, but it does not stay.  Once your session is closed, the alias goes away.  So how do we keep it constant?  Add it to your profile.

0 comments: