Windows 7 Command Line Add Group “Users” To File

command linepermissionswindows 7

I need to change permissions on a file/folder through the command line. I can do this manually by:

  • Right-click on any file/folder
  • Properties
  • Security (tab)
  • Edit…
  • Add…
  • Enter the object names to select: Users
  • OK

How do I do this using a command line.

Edit:

This works

icacls "C:\folder1\folder2\file.txt" /grant:r Users:F

The problem is I want to select the parent folder and for it to effect all files.

Doesn't work:

icacls "C:\folder" /grant:r Users:(OI)(CI)F

Is it because icacls can't refer to a folder??

Best Answer

I think icacls is what are you looking for, e.g.:

D:\>icacls D:\path\to\directory /grant administrators:F /t

Take a look: http://technet.microsoft.com/de-de/library/cc753525%28v=ws.10%29.aspx

Related Question