Setting Folder Permissions with icacls RRS feed

  • Question

  • I wrote a Simple Batch Program that my installer uses to set the folder permissions.


    I have my saved data in C:\Users\All Users\Company\App\


    I was using-->  icacls "C:\Users\All Users\Company\" /Grant Users: F


    However, it is not setting the folder correcly.  Do I need to restart the computer after I make the changes?



    How can I have My installer Set my Folder permissions to allow myself write acces to my folder.


    thanks in advance,


    Monday, February 11, 2008 11:35 PM

All replies

  • In order to grant users, you may need to take ownership.


    icacls "C:\Users\All Users\Company\" /setowner ...


    Thursday, February 14, 2008 7:27 PM
  • BUMB

    Was just searching for a solution to the same problem as this turned up as one of the first results.. In case someone else has the same problem and follow the same line of inquiry I'll just drop the solution here to save them of all the countless and futile searches that followed before I realized my mistake.

    To make the above work so that you add full control to the folder as well you have to add the two inheritance flags (OI) and (CI) to make the above look like this:

    icacls C:\Users\All Users\Company\ /inheritance:e /grant:r Users:(OI)(CI)F

    Not quite sure if the /inheritance:e is needed, but it do no harm. I ran it as "Run as admin" from the prompt.

    (Btw, you only need quotation marks if a value contains spaces.)

    Saturday, January 1, 2011 3:42 AM
  • Unrelated to your question, but as a point of policy, try to avoid hardcoded paths.  There are CSIDLs and KnownFolderIDs you should be referencing that may save you a headache at some future date.
    Wednesday, January 12, 2011 7:47 PM