- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to overwrite or remove PowerShell alias?
You can overwrite the Powershell alias by redefining it. For example, if the alias is created Edit for Notepad.exe and if you want to overwrite it with another program, say wordpad.exe then use the below command.
We will overwrite the Edit alias cmdlet with Wordpad.exe using the Set-Alias command. When you close the PowerShell session, it will remove newly created aliases and modified aliases.
Set-Alias edit "C:\Program Files\Windows NT\Accessories\wordpad.exe"
You cannot overwrite pre-defined aliases. It will throw an exception.
For example, when you try to modify dir alias which points to Get-Content, error output will be as below.
To remove newly created aliases without closing the PowerShell console, you need to use RemoveAlias command.
Remove-Alias -AliasName Edit
You can also use Del command to remove the alias.
Again you cannot remove the Aliases which are permanent. Only newly created aliases can be removed and automatically deleted when the session ends.
- How to create PowerShell alias permanently?
- How to create new alias with PowerShell?
- How to use function Alias in PowerShell?
- What is an alias in PowerShell?
- How to use an alias() for the parameter in PowerShell?
- How to get/resolve the command from the alias in PowerShell?
- How to remove windows features using PowerShell?
- How to remove Windows service with PowerShell?
- How to remove empty string/lines from PowerShell?
- How to remove windows folder sharing using PowerShell?
- How to remove the mapped network drive using PowerShell?
- How to use PowerShell as a Calculator? Or How to use PowerShell for arithmetic operations?
- How to add/remove values in the array in PowerShell?
- How to remove pagefile on the specific drive using PowerShell?
- How to remove connected remote desktop user sessions using PowerShell?