NSIS 2.46 offcial
The value of $PROFILE:
SetShellVarContext all
MessageBox MB_OK "$PROFILE"
SetShellVarContext current
MessageBox MB_OK "$PROFILE"
Is the same value.
I suggest using GetAllUsersProfileDirectory function instead:
http://msdn.microsoft.com/en-us/library/bb762276.aspx
The docs don't say anything about SetShellVarContext affecting $Profiles, if you check the helpfile under "4.2.3 Constants" you see that only a couple of the constants have all user versions so this is not a bug but a feature request...
In the mean time use this code:
!include LogicLib.nsh
Section
/*
WARNING: This code is might work on WinNT4 (Only profiles root might work on Win9x, and 9x does not usually have profile support turned on)!
*/
/* All users profile*/
system::call 'Userenv::GetAllUsersProfileDirectory(t.r0,*i ${NSIS_MAX_STRLEN})i.r1'
${If} $1 = 0
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" ProfilesDirectory
ReadRegStr $1 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" AllUsersProfile
ExpandEnvStrings $0 $0\$1
${EndIf}
DetailPrint $0
/* Default profile*/
system::call 'Userenv::GetDefaultUserProfileDirectory(t.r0,*i ${NSIS_MAX_STRLEN})i.r1'
${If} $1 = 0
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" ProfilesDirectory
ReadRegStr $1 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" DefaultUserProfile
ExpandEnvStrings $0 $0\$1
${EndIf}
DetailPrint $0
/* Profiles root*/
system::call 'Userenv::GetProfilesDirectory(t.r0,*i ${NSIS_MAX_STRLEN})i.r1'
${If} $1 = 0
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" ProfilesDirectory
ExpandEnvStrings $0 $0
${IfNotThen} ${FileExists} "$0\*" ${|} StrCpy $0 $windir\Profiles ${|}
${EndIf}
DetailPrint $0
SectionEnd