Windows Tip: Deleting Files that Won’t Delete

Have you ever been frustrated to find that you’ve got files that just won’t delete? You don’t have permission to delete your own file? What’s wrong with Microsoft! I said I wanted to delete it, so go ahead and do it!?!?


Yeah, that’s a pretty common problem to run into with Windows and can be really frustrating if the file is somewhere like on your desktop; nobody wants useless files to be permanently plastered in front of their face forever. Thankfully though, there is a very easy solution to this common problem. Now sometimes the file really is open somewhere and files that are in use can’t be deleted. If this is the case, then just close the program that’s using the file or reboot your system then the file should be freed for deletion once more.

But those hard to delete files that aren’t open are even more frustrating. Thankfully there is actually an even easier solution to deleting those than just rebooting! The problem is caused by file permissions: the user you are logged on as (presumably yourself) does not have full control over the file and so does not have permissions to delete it. Now the mess continues because often times you don’t have ownership of those files either… Yeah, it’s complicated. The solution, thankfully is not.

Rather than making you go through hoards of complex context menus (right click menus), I have a great little registry entry that can save you time on many occasions. It does all that for you, and it even adds a button on the context menu to allow you to do all this automatically with any file or folder you want whenever you want. Don’t say I don’t take good care of you guys!

Download: Take Ownership

How to use:

  1. Download file to your computer
  2. Unzip the file take_ownership.reg
  3. Right-click on it and select Merge
  4. Say Yes to the UAC prompt
  5. Click on Yes when asked if you want to add it to the registry
  6. Right-click on whatever file or folder you want to take ownership of
  7. Click on Take Ownership
  8. A command prompt will pop up and do stuff and close when done
  9. You now have full access rights over the file or folder in question

Please be aware that you shouldn’t use this to delete files if you don’t know what they are for. Often times files are protected by Windows from accidental or malicious deletion. You can always use this tip to do other things to files like modify them or compress them if you don’t have permissions to. There really are very few limitations to what you can take ownership of. I’ve used this on Windows XP, Windows Vista and Windows 7 RC1 all with the same great results. It might work on older versions of Windows, but I wouldn’t bet my life on it.

For those who are really curious, here is the code added to the registry that makes this all work:

Windows Registry Editor Version 5.00

@=”Take Ownership”

@=”cmd.exe /c takeown /f “%1” && icacls “%1″ /grant administrators:F”
“IsolatedCommand”=”cmd.exe /c takeown /f “%1” && icacls “%1″ /grant administrators:F”

@=”Take Ownership”

@=”cmd.exe /c takeown /f “%1” /r /d y && icacls “%1″ /grant administrators:F /t”
“IsolatedCommand”=”cmd.exe /c takeown /f “%1” /r /d y && icacls “%1″ /grant administrators:F /t”

Leave a Reply

Your email address will not be published. Required fields are marked *