How to rename an alias in PowerShell?

Posted by jwfearn on Stack Overflow See other posts from Stack Overflow or by jwfearn
Published on 2011-01-11T18:26:57Z Indexed on 2011/01/12 21:53 UTC
Read the original article Hit count: 479

Filed under:
|

I want to make my own versions of some of the builtin PowerShell aliases. Rather than completely removing the overridden aliases, I'd like to rename them so I can still use them if I want to. For example, maybe I'll rename set to orig_set and then add my own new definition for set.

This is what I've tried so far:

PS> alias *set*

CommandType     Name     Definition
-----------     ----     ----------
Alias           set      Set-Variable

PS> function Rename-Alias( $s0, $s1 ) { Rename-Item Alias:\$s0 $s1 -Force }
PS> Rename-Alias set orig_set
PS> alias *set*

CommandType     Name     Definition
-----------     ----     ----------
Alias           set      Set-Variable

Any ideas as to why this isn't working?

© Stack Overflow or respective owner

Related posts about powershell

Related posts about alias