Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

set permissions in a batch file 1

Status
Not open for further replies.

franklin97355

Technical User
Jul 11, 2002
3,753
US
Is there a way to set the permissions for a folder from a command I could use in a batch file? I need to create a folder, copy some files to it and then give a group full access rights to that folder and files. Thanks.
 
There is a dos command to change permissions called cacls which can be used in a batch file. If you open a dos window and type "cacls /?" you will get the full syntax.

Examples:
cacls c:\test /T /G "DomainName\Domain Admins":F DomainName\joe:C

The above gives the domain admins full permissions to c:\test and the domain user joe change permissions.

The command does ask for confirmation when it is run so, if you need it to be silent then there is an old batch file trick where you pipe a 'y' into the command. So to run the above example silently you would use:

echo y|cacls c:\test /T /G "DomainName\Domain Admins":F DomainName\joe:C
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top