Skip to content
⌘ NSIS Forum Archive

Obtain Current Users %APPDATA% Path and not Admins

4 posts

gretty#

Obtain Current Users %APPDATA% Path and not Admins

Hello

I am looking to get the path to the current users %APPDATA% folder.

Note: I am aware of the variable $APPDATA BUT if you run your installer with RequestExecutionLevel admin then $APPDATA will point to the admins roaming folder and NOT the current user's app data folder.

I need to find out the current users %APPDATA% path so I can write files to their roaming directory. Does anyone know how I can find this out?

RequestExecutionLevel  admin

Section "Main"
MessageBox MB_OK "AppData is: $APPDATA" # knowtice that its the path to the admins folder not the current user's
SectionEnd
JasonFriday13#
Try 'SetShellVarContext current'. Probably won't work since the installer runs under the admin user account (can't test this right now because I'm on linux).

RequestExecutionLevel  admin

Section "Main"
SetShellVarContext current
MessageBox MB_OK "AppData is: $APPDATA" # notice that its the path to the admins folder not the current user's
SectionEnd
Anders#
Originally Posted by Afrow UK View Post
You should probably use the UAC plug-in to do this.
That plugin is horrible and should only be used as a last resort. I posted my recommended solution here