7

Possible Duplicate:
How to grant permission to users for a directory using command line in Windows?

I want to grant all users of a system the permissions of read, write and modify for a folder. I think there would be a command line that I use to do that, but if there is nothing and I have to write a code for it please help me with it.

Main Problem is that I want to grant these permissions to all users, usually I don't care about UserNames and I want to put "*" instead of usernames, to apply new permissions for all users.

any idea? Thanks.

Community
  • 1
  • 1
Reza Ameri
  • 1,803
  • 3
  • 24
  • 32

1 Answers1

23

There is a command line - CACLS.

For example, to add "Everyone" with "Full Control" to the folder c:\temp\test you would use:

REM /t means "apply change recursively"
REM /e means "edit existing DACL". 
REM     Omitting this will overwrite the existing DACL.
cacls c:\temp\Test /t /e /g Everyone:f
RB.
  • 36,301
  • 12
  • 91
  • 131
  • By everyone here you mean every user in every domain that uses this computer? – Reza Ameri Oct 04 '12 at 10:47
  • 1
    `Everyone` is a built-in group in Windows. See http://ss64.com/nt/syntax-security_groups.html for a list. You can also use CACLS to set permissions for individual users, using (for example) ` /g MyDomain\RB:f` to give me FullControl. – RB. Oct 04 '12 at 10:55
  • 1
    Giving everyone modify permission means anyone can delete the folder... anyone... any software... any virus... anyone! Generally, if you're on a Windows Domain, it's better to use the built in group 'Authenticated Users' which is everyone logged in. – Paul D'Ambra Oct 04 '12 at 10:57
  • 2
    On any halfway recent Windows I'd recommend using [`icacls`](http://technet.microsoft.com/en-us/library/cc753525%28v=ws.10%29.aspx) instead of `cacls`. Unlike the latter the former will also handle inheritance. – Ansgar Wiechers Oct 04 '12 at 18:42
  • i was looking for recursive. I used /T /C successfully. Thanks. – Felipe Alvarez Dec 01 '13 at 03:53