Answered ICACLS - correct syntax help please

  • Friday, November 23, 2012 8:02 AM
     
     

    Hi, I need to change permissions on a bunch of subfolders, all with the same name (eg. A) but cannot seem to get the syntax correct. I have a parent folder called e:\test, within that I have sub folders called 1, 2 and 3. In each of those is an A and B folder. Now what I woulike like to do is from the parent test folder, run ICACLS on any subfolder under 1, 2 and 3 called 'A' (on my production server the folder is called Management) and change permissions. This is what I've tried:

    for /f %i in ('dir e:\test\*a* /s /ad') do icacls %i /grant "management":(OI)(CI)F /inheritance:r

    I have tested the ICACLS part on it's own and it works fine. The issue is the FOR and dir... part.

    Any help please?

All Replies