Old 17th March 2014, 23:38   #1
gretty
Junior Member
 
Join Date: May 2012
Posts: 20
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?

code:
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

gretty is offline   Reply With Quote
Old 18th March 2014, 02:29   #2
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 892
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).

code:
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


"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Old 18th March 2014, 08:15   #3
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
You should probably use the UAC plug-in to do this.

Stu
Afrow UK is offline   Reply With Quote
Old 18th March 2014, 14:29   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,321
Quote:
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

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump