Once one creates aliases, at times they find one or two must be deleted. In this tutorial, you will learn how to delete the aliases you've created in PowerShell.
If you have not already done so, click open Windows PowerShell ISE.
Deleted aliases isn't complicated at all, as a matter-of-fact, the opposite of New-Item is Remove-Item. If you want to get rid of the se alias you created in the previous tutorial (Creating Aliases in PowerShell), you can run this line:
Remove-Item alias: se
You can also delete multiple aliases at once. If you just so happened to create a slew of aliases like thealias1, thealias2, etc., then all you would need to do is delete all that appear like it right? Use the following code and simply replace the "thealias#" with your alias name of course.
Remove-Item alias: thealias*
If the alias you are removing just so happens to be defined with the ReadOnly option, you have to use the Force parameter to get rid of it (otherwise PSH will output an error that it can't be deleted). Implement the force parameter like so:
Remove-Item alias: se -force
A rather short tutorial, surely you would agree. Just a little simpler if we split the concepts up. You will come to find aliases quite handy at times. Join us next time for additional Windows PowerShell tutorial