alex001
30th August 2011 17:07 UTC
$DOCUMENTS not pointing to the correct folder in Windows 7
Hello,
i try to install some file to a standard's user My Documents folder in Windows 7.
The problem is that the files are installed in the My Documents folder of the administrator instead !!
Is not the constant $DOCUMENTS working in Windows 7 correctly ?
Thank you
Alex
MSG
30th August 2011 17:43 UTC
requestexecutionlevel user
(Reason: Win7 auto-elevates NSIS installers if they don't have a manifest.)
alex001
30th August 2011 19:00 UTC
ok thanks for the quick answer
alex001
31st August 2011 09:14 UTC
Hello,
that is not a solution. Now i cannot install any application to Program Files etc.
Admin level is required.
Isn't there another workaround ?
MSG
31st August 2011 11:09 UTC
If your installer is running at admin level (which is necessary if you want to install to $PROGRAMFILES), you have no business writing to a user's documents folder. An installer that requires admin access should always install for all users (this is simply how Windows is designed). Therefore you should be using the allusers Documents folder (simply use setshellvarcontext all for this).
Conversely, if you want to do stuff at userlevel (such as writing to one user's documents), the whole install should be executed at userlevel. This means you should install to $APPDATA or $LOCALAPPDATA instead of $PROGRAMFILES, and write to HKCU instead of HKLM.
Edit: And note that for proper Win7 compatibility, you should add requestexecutionlevel (admin or user) to your installer in any case.