locked
How to execute iCACLS from (.cmd) or (.bat) file RRS feed

  • Question

  • I have the following command to set the folder permission

    FOR /F %i IN (D:\Sample\Sample.txt) DO  ICACLS  /grant "IIS_IUSRS":(OI)(CI)F 

    for particular path obtained from the text file, this works fine if i execute independently from the command prompt window, but the same syntax does not work if add it .cmd or .bat file and try to execute, please can i know am i missing any additional syntax to make this perfectly work when it is ran through .cmd or .bat file


    Mahesh

    Saturday, April 7, 2012 9:43 AM

Answers

  • This work  (in your example the %%i was absent ...)

    @echo off
    ::
    :: acl.cmd
    ::
    FOR /F %%i IN (D:\Sample\Sample.txt) DO  ICACLS %%i /grant "IIS_IUSRS":(OI)(CI)F 
    


    Gastone Canali >http://www.armadillo.it

    Se alcuni post rispondono al tuo quesito (non necessariamente i miei), ricorda di contrassegnarli come risposta e non dimenticare di contrassegnare anche i post utili . GRAZIE!

    • Proposed as answer by GastoneCanali Thursday, April 12, 2012 8:10 PM
    • Marked as answer by Cloud_TS Friday, April 13, 2012 6:22 AM
    Saturday, April 7, 2012 12:06 PM