- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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.
Del alias:Edit
Again you cannot remove the Aliases which are permanent. Only newly created aliases can be removed and automatically deleted when the session ends.