Jump to content

Having permission issues/glitches of removing certain folders on your PC? Look no further.

Haven't been here for years. ^^

 

I've decided to share a special method I've been using to remove greedy/glitched folders from my system for years.
What I mean by that is sometimes, folders can't be deleted, even if you were the one who created it.
Windows will spout things like "You don't have permission.." or "You need permission from XXX.." etc.
Sometimes it will even try to convince you the folder doesn't exist. (aka after say drive corruption etc.)

 

I realize there might be more complicated/straightforward ways of doing it, but this one takes a lot less time to do.

 

There's nothing too advanced/involved really, you just have to simply create an text file,

then type the following below, replacing 'SubSpecs' and 'C:\test' with your PC's user account name and the folder you wish to remove, then save the text file as an .bat file.

takeown /f "C:\test" /r /d y
icacls "C:\test" /grant SubSpecs:(OI)(CI)F /T
rmdir /s /q "C:\test"
pause

 

Breakdown:
takeown - Enables an administrator to recover access to a file that previously was denied, by making the administrator the owner of the file. (/r - recursive, applies to all files in dir.)
icacls - Displays or modifies discretionary access control lists (DACLs) on specified files, and applies stored DACLs to files in specified directories. (/grant - gives user permissions.)
rmdir - Deletes a directory.

 

 

Hope this helps some of you in the future. ^^

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×