Archive: $DOCUMENTS not pointing to the correct folder in Windows 7


$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


requestexecutionlevel user


(Reason: Win7 auto-elevates NSIS installers if they don't have a manifest.)


ok thanks for the quick answer


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 ?


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.