Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have this, pretty sure its a little harsh but does the job, gives me all the rights to the files and folders on a drive when run on a drive, now I need help getting it to go into sub directories, so I dont need to copy the bat script inside every folder and have to run it.

takeown /f *
icacls * /grant Administrator:F
icacls * /grant Administrators:F
icacls * /grant SYSTEM:F
icacls * /grant "Authenticated Users":F

How would I get it to traverse the drive recursively?

share|improve this question

Short Answer: add /t to (i)cacls

Long answer:

Here is my script I use when I want the file to be accessible to any user. It includes comments on what each flag does. Just put this in a batch file somewhere in the %AppData% folder.

REM --v2 -----------------------------------------------------------
takeown /r /d y /f %1
icacls %1 /t /grant Everyone:F

REM takeown /r /d y /f will set the owner to the Administrators group recursively.
REM /t makes it recursive
REM /grant Sets the permision to the following user, replaces existing permissions for the specified uesr.
REM :f Grants full controll permission.
REM ----------------------------------------------------------------

REM --v1 -----------------------------------------------------------
REM cacls %1 /t /e /g Everyone:f

REM /t makes it recursive
REM /e Edits the ACL instead of replaceing it
REM /g Grants permissions to the following users
REM :f Grants full controll permission.
REM ----------------------------------------------------------------

Then in %AppData%\Microsoft\Windows\SendTo create a shortcut to the batch script.

Edit the properties of that shortcut and go to Advanced... and check the box Run as Administrator.

enter image description here

Now in your right click menu -> Send To you will have a item called Fix Permissions any file or folder you do a Send To on will have the Everyone group given Full Access permissions. If you perform it on a folder it will recursively go through it and apply the permissions to all of the children in the folder.

I save the batch file the %AppData% folder because I am on a domain and that makes it part of my roaming profile so it will be on and ready to use on any computer I connect to.

share|improve this answer
you might want to add takeown as well. – Sathya Apr 30 '12 at 14:57
@Sathya very cool, never knew about that, I am adding it to my script – Scott Chamberlain Apr 30 '12 at 14:58
Looks good Scott! – Sathya Apr 30 '12 at 15:32
how do you remove the current folder/files security settings, before adding new ones? – wiak May 1 '12 at 21:19
@wiak by using /grant:r instead of /grant. I wanted to keep the existing ones and add Full Control to the Everyone group. – Scott Chamberlain May 1 '12 at 22:38

Will this work for network shares?

Takeown /f *
icacls * /grant Administrator:F
icacls * /grant Administrators:F
icacls * /grant SYSTEM:F
icacls * /grant "Authenticated Users":F
icacls * /grant "doamin\users":R
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.