Nullsoft installer to make the programdata subfolder writable

The ProgramData folder is the best place to store your files for writing, accessible to all users. But when the Nsis installer starts as administrator (which is required for writing to Program Files), the folders and files created in the ProgramData folder are read only for all users except admin. How to change this and have files for recording for all users inside the ProgramData folder?

+7
source share
2 answers

I don't know if this behavior is a feature or a bug, but I found a workaround. AccessControl plugin is required (download and copy the Nsis plugins folder). In the "install" section of the Nsis script section, enter something like this:

; This is important to have $APPDATA variable ; point to ProgramData folder ; instead of current user Roaming folder SetShellVarContext all ; This sets us permissions AccessControl::GrantOnFile "$APPDATA\Folder" "(S-1-5-32-545)" "FullAccess" AccessControl::GrantOnFile "$APPDATA\Folder\*" "(S-1-5-32-545)" "FullAccess" 

S-1-5-32-545 is equivalent to all users , so this code will provide full access to the specified folder and all files for all users.

+7
source

or install via the command line (Win7 only): ExecWait 'Icacls "$ APPDATA \ Folder" / grant Users: (OI) (CI) M'

+1
source

All Articles