Old 12th October 2007, 04:10   #1
jhahn0
Junior Member
 
Join Date: Oct 2007
Posts: 2
Having problems with trailing backslash

I've created my first NSIS script (makes you cringe when you see that in a post, I'm sure) and I used the EclipseNSIS plug-in for Eclipse. I'm installing a file, adding a registry key, and adding string values to the registry key. Someone else has inherited the development of the program I'm installing and I'm trying to help him deploy it. I've spent hours searching the forums, looking in the docs/faqs, and searching Google. I haven't found anything to get this to work or maybe I'm just too tired right now.

One of the string values added to the registry is
Quote:
BASE_DIR=\\server\share\folder$\
The EclipseNSIS created this line of code to add it to the registry:
code:
WriteRegStr HKEY_LOCAL_MACHINE SOFTWARE\company\program BASE_DIR \\server\share\folder$\


Compiling gives me this error:
Quote:
WriteRegStr expects 4 parameters, got 8.
Usage: WriteRegStr rootkey subkey entry_name new_value_string
root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD|SHCTX)
Error in script "C:\Documents and Settings\me\My Documents\setup_silent.nsi" on line 74 -- aborting creation process
Line 75 is
code:
WriteRegStr HKLM "${REGKEY}\Components" Main 1

which is how it gets 8 parameters in the error.

I do not have control over the $ and the trailing backslash.

I have tried many different variations of $$, \\, and all three types of quotes. I've managed to just get warnings, but the output is never right in the registry. I end up with multiple "$"s, multiple "\"s, no "$", and/or no trailing "\" at the end of the string value in the registry.

Removing the trailing backslash allows the script to compile and run just fine (except now I do not have the trailing backslash).

Can someone figure this out? If not, perhaps I'll look at getting NSIS to run an embedded cmd script that loads an embedded .reg file. I was just (futilely) trying to keep it all NSIS. Maybe the answer is to add the string without the trailing backslash and then concatenate the trailing backslash. Perhaps I'll see how to do that tomorrow.

Thank you in advance for any help/suggestions.
jhahn0 is offline   Reply With Quote
Old 12th October 2007, 07:37   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Use quotes around the path.

Stu
Afrow UK is offline   Reply With Quote
Old 12th October 2007, 16:20   #3
jhahn0
Junior Member
 
Join Date: Oct 2007
Posts: 2
Afrow, I had tried that with ", ', and ` quotes around that parameter.

Using ":
code:
WriteRegStr HKEY_LOCAL_MACHINE SOFTWARE\company\program BASE_DIR "\\server\share\folder$\"

I get this error:
Quote:
Error: unterminated string parsing line at C:\Documents and Settings\me\My Documents\setup_silent.nsi:73
Error in script "C:\Documents and Settings\me\My Documents\setup_silent.nsi" on line 73 -- aborting creation process
Using ':
code:
WriteRegStr HKEY_LOCAL_MACHINE SOFTWARE\company\program BASE_DIR '\\server\share\folder$\'

I get this error:
Quote:
Error: unterminated string parsing line at C:\Documents and Settings\me\My Documents\setup_silent.nsi:73
Error in script "C:\Documents and Settings\me\My Documents\setup_silent.nsi" on line 73 -- aborting creation process
Using `:
code:
WriteRegStr HKEY_LOCAL_MACHINE SOFTWARE\company\program BASE_DIR `\\server\share\folder$\`

I get this error:
Quote:
Error: unterminated string parsing line at C:\Documents and Settings\me\My Documents\setup_silent.nsi:73
Error in script "C:\Documents and Settings\me\My Documents\setup_silent.nsi" on line 73 -- aborting creation process
I was just thinking about $\ being used to escape quotes, which is why just putting quotes around that parameter does not work. So, I just tried this:
code:
WriteRegStr HKEY_LOCAL_MACHINE SOFTWARE\company\program BASE_DIR $\"\\server\share\folder$\$\"

Now it will compile and run, but the string in the registry has double quotes around it (i.e.,
Quote:
"\\server\share\folder$\"
and I want
Quote:
\\server\share\folder$\
.

Any other ideas? Should I just pull out the quotes after writing the string? Can you do that? Like I said before, I’ve tried all different kinds of combinations with the dollar sign, the backslash, and the 3 different quotes, like …$$\, …$$\\, “…$$\\”, etc., but I’m not the pro like most of you out there providing help. I was hoping someone more familiar with the syntax or NSIS scripting could tell the correct way to write this line or how to get around this issues.

Thank you and I apologize for the long posts. I just want to make sure I'm being thorough.
jhahn0 is offline   Reply With Quote
Old 12th October 2007, 16:36   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
"\\server\share\folder\"

Stu
Afrow UK 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