Cannot delete a file or folder, even if you own it

You know what I really hate? When I tell Windows to delete something and bloody TrustedInstaller gets all high and mighty and says “no”… So I then go and take ownership of the file, strip all the permissions off it, and then try to delete it, and then says “Sorry, you need permission from Markus to delete this file”…. Excuse me? I, need to ask myself… to delete a file? Windows, go home, you’re drunk…

Anyway, to nuke the perms of a folder, take all ownership and show windows who is boss, run these commands in an elevated CMD prompt:

takeown /R /A /F [foldername] /D N
icacls [foldername] /grant Administrators:F /T /C

Then you can delete the damn folder… Hurray!

Leave a Reply

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