20

I'm trying to give full access (read, write) to a specific folder to all users on Windows 7. The problem is that I don't know how to do that using icacls.

24
c:\windows\system32\icacls c:\folder /grant "domain\user":(OI)(CI)M
c:\windows\system32\icacls c:\folder /grant "everyone":(OI)(CI)M
c:\windows\system32\icacls c:\folder /grant "Authenticated Users":(OI)(CI)M

Open command window and type c:\windows\system32\icacls /?

5
  • 5
    +1. Depending on context, (OI)(CI)F (full access) might be preferable to (OI)(CI)M (read/write access). – Harry Johnston Nov 29 '11 at 2:15
  • Alas, cut and paste fom one of my scripts :-) M = Modify which is fine for most users, F will give them everything – BoBo Nov 29 '11 at 6:45
  • 7
    Note that you will NOT be able to use "everyone" and other groups on localized Windows (English names are only available on English Windows). So you might want to use one of SID (e.g. "everyone" is "*S-1-1-0" -- take note of the use of use star before SID) support.microsoft.com/en-us/kb/243330 – Nux Oct 16 '15 at 12:36
  • Issuing icacls . /t /grant "everyone": (OI) (CI) F returns "Invalid parameter "everyone:"" – Thom Sep 4 '18 at 12:23
  • @Bobo The OP requested full access. Your answer needs to be that. You can suggest Modify in the answer as well if you think it's appropriate. – Thom Sep 4 '18 at 12:24
6

Only these two answers worked for me:

In an Administrator Command Prompt:

C:\Windows\System32>takeown /r /d y /f f:\backup
C:\Windows\System32>icacls f:\backup /t /grant Everyone:(OI)(CI)F

(OI) is for future files and (CI) for future folders.

2

This worked for me:

Step 1 - Open cmd window with admin privileges

Step 2 - to take ownership of contents of "picts" directory takeown /f C:\picts* /r

Step 3 - to change permissions to "everyone" of contents of "picts" directory icacls C:\picts /grant Everyone:F /t

1

Open administrator command prompt. And run

grantAccess.cmd FOLDER_PATH 

where FOLDER_PATH can be:

  • "d:" - for change whole drive
  • "d:\somefolder" - for change folder

grantAccess.cmd file content is:

@echo off

rem FOLDER_PATH can be "d:" or "d:\somefolder"

set FOLDER_PATH=%1

echo taking ownership...
takeown /F "%FOLDER_PATH%" /R /D Y /SKIPSL
if %ERRORLEVEL% neq 0 goto error

set SUBELEMENTS=/L /T /C
set QUIET=/Q
set USERNAME=*S-1-1-0

echo setting access rights for the root folder
icacls "%FOLDER_PATH%" /inheritance:r /grant:r "%USERNAME%":(OI)(CI)F
if %ERRORLEVEL% neq 0 goto error

echo reset access rights for childs
ICACLS "%FOLDER_PATH%\\*" /reset %SUBELEMENTS% %QUIET%
if %ERRORLEVEL% neq 0 goto error

echo change owner
icacls "%FOLDER_PATH%" /setowner "%USERNAME%" %SUBELEMENTS% %QUIET%
if %ERRORLEVEL% neq 0 goto error

:success
echo SUCCESS!!!
EXIT /B 0
:error
echo ERROR!!!
EXIT /B 1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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