Old 10th May 2013, 22:42   #1
Junior Member
Join Date: Jun 2010
Posts: 9
Question Variable in a string

I feel that this very likely is a stupid question, but I've been unable to locate an answer so...

I need to insert a variable into a line of code without spaces.
WriteRegStr HKCU "SOFTWARE\blah blah" "Test" "00$VAR1text$VAR2"

Obviously the compiler thinks it's looking for $VAR1text variable that does not exist. How can I separate the variable from the text in the string?

Also the other defines work because they have the {} wrapper, but I can't always use those:

!define VAR1 "blah blah"
!define VAR2 "blah blah"
WriteRegStr HKCU "SOFTWARE\blah blah" "Test" "00${VAR1}text${VAR2}"

Thanks, folks~
Plainjay is offline   Reply With Quote
Old 11th May 2013, 11:49   #2
Senior Member
aerDNA's Avatar
Join Date: Feb 2007
Location: Rijeka, Croatia
Posts: 225
You shouldn't be having that problem, I can't even replicate it. Maybe you could post the actual code you're using cause there's nothing wrong with this particular example; you definitely shouldn't be getting a compiler error.

aerDNA is offline   Reply With Quote
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

string, variable

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