- Follow via:
- RSS
- Email Alert
Question
0
Votes
How do I use a variable in icacls.exe for the username
I am writing a script to change the ntfs security on hundreds of folders on Windows Server 2008. I need to be able to use the icacls.exe with a variable in place of the username in the /grant:r switch. I have tested this and tried numerous things over the past few days and now am at a critical time where I need to get this resolved. I have searched numerous forums online and have come up empty handed. Please help! Tell me if there is a way to do what I need to do or if I am dreaming!!
16th Mar 2010
Answers (2)
0
Votes
like this
set userv=auserid
icacls c:\dir\tochange /grant:r %userv%:(OI)(CI)(IO)RX
icacls c:\dir\tochange /grant:r %userv%:(OI)(CI)(IO)RX
24th Mar 2010
0
Votes
same boat
I'm also re-doing my user creation script. Originaly, I made my script for Server2003 and used Cacls for the permissions. I'm currently trying to figure out syntax for ICACLS as I had it for CACLS (haven't had any luck with CACLS on Server2008).
Have you tried Cacls, or are you just trying to go with ICacls?
I will say one thing about variables in scrips, and that is to mind your quotations. Quote the command, unquote the variable and put ampersand before and after, quote again for switches.
Have you tried Cacls, or are you just trying to go with ICacls?
I will say one thing about variables in scrips, and that is to mind your quotations. Quote the command, unquote the variable and put ampersand before and after, quote again for switches.
21st Jun 2010

































