Deleting Things

To delete things in the file system, you normally use a command like "del", which is an alias and points to Remove-Item in PowerShell:

get-command del

You can use del to delete a variety of things:

Delete a variable named "test":

del variable:test

Delete a function named "test":

del function:test

Delete an alias named "test":

del alias:test

Delete a registry key named HKEY_CURRENT_USER\Test:

del HKCU:\Test

You should remember to use the -force parameter if the item you want to delete is write-protected.


Posted May 21 2009, 08:00 AM by ps1
Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.