Поделиться через


Using the Set-Alias Cmdlet

Remapping an Existing Windows PowerShell Alias

Set-Alias allows you to map an existing alias to a different cmdlet. For example, suppose you have an alias named show that, for some reason, is mapped to the Remove-Item cmdlet. You’d prefer that show be mapped to Get-ChildItem. Well, why didn’t you say so:

Set-Alias show Get-ChildItem

Just call Set-Alias followed by the alias name, followed by the appropriate cmdlet. That’s all you have to do.

Although there’s no corresponding cmdlet set aside for removing a mapped alias, you can achieve that task by using Remove-Item:

Remove-Item alias:\show