Skip to content
⌘ NSIS Forum Archive

ReadRegStr/ReadRegDWORD using variables

6 posts

DennisFeiock#

ReadRegStr/ReadRegDWORD using variables

I've been working on a NSIS script and have ran into a rather large wall. The problem I have is that my script will not compile because of the following line:

ReadRegStr $4 "$5" "$6" "$7"

I have the quotes to make sure that any spaces contained in those variables will not cause problems.

When I do a DetailPrint of this line, I get the following results:

ReadRegStr REG_SZ "HKLM" "SOFTWARE\NSIS" "C:\Program Files\NSIS"

The reason REG_SZ is assigned to $4 is to get it to this point as a temporary variable.

When I take the output of the detailprint, then put it in my code (after replacing REG_SZ to $4) then the script will compile just fine.

Is there any way to make the ReadRegStr and/or ReadRegDWORD command accept searches based entirely off of variables?

Thanks a ton!
- DF
Afrow UK#
HKLM/HKCU etc are set on compile time therefore cannot be set via variables. You need to check the value of that variable and decide which root to use.

-Stu
ParallaxTZ#
Setting the root by a variable, how did you do this? I have to do multiple commands like this within 5 lines from each other (command, 5 others, command, 5 others, etc) and was wondering what you guys did to decide which root to use? (I was hoping for an elegant solution.)