View Single Post
Old 22nd July 2019, 06:40   #1
bankeris
Junior Member
 
Join Date: Feb 2014
Posts: 24
NSIS request admin/user depend on registry

Hello,

Can someone help me a bit with NSIS v3.04?

I want NSIS to check registry and depend on registry value RequestExecutionLevel user or admin. I'm moving users from ProgramFiles(only DLL stored) to localdisk folder to make sure they wont need admin rights on next and future updates, but not everyone installs it regularly so I created registry value as mark.

Code I'm using:
ReadRegStr $INSTDIR HKCU "Software\....." "my registry value as string"
StrCmp $INSTDIR "" 0 NoAbort
MessageBox MB_OK "messgebox for testing purpose"
RequestExecutionLevel admin

When I tried to put on top but got message:
Error: command ReadRegStr not valid outside Section or Function

When i tried to use it in Function .onInit :
Error: command RequestExecutionLevel not valid in Function
bankeris is offline   Reply With Quote