Old 24th September 2006, 15:42   #1
da_bear
Junior Member
 
Join Date: Sep 2006
Posts: 1
Send a message via Yahoo to da_bear
Question Write reg string containing "\""

Hey

I am trying to set the value of a regsitry string to
something that in C would look like this
"\"ASDF\" \"%1\"". Can anyone help me?

Oh, I almost forgot ...
Which are the escape characters in the NSIS script language?


thanks
Mr Bear
da_bear is offline   Reply With Quote
Old 24th September 2006, 16:27   #2
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
From a Search in the Help File for "escape"

Result 1: "Script Files"
2.2 Script Files
If you want to use a double-quote in a string you can either use $\" to escape the quote or quote the string with a different type of quote such as ` or '.

Result 2: "Script File Format"
4.1 Script File Format
Quotes only have the property of containing a parameter if they begin the parameter. They can be either single quotes, double quotes, or the backward single quote.

You can escape quotes using $\:

code:

MessageBox MB_OK "I'll be happy" ; this one puts a ' inside a string
MessageBox MB_OK 'And he said to me "Hi there!"' ; this one puts a " inside a string
MessageBox MB_OK `And he said to me "I'll be fucked!"` ; this one puts both ' and "s inside a string
MessageBox MB_OK "$\"A quote from a wise man$\" said the wise man" ; this one shows escaping of quotes



So...

code:

WriteRegStr HKCU "Software\myApp\" "Somevar" "$\"ASDF$\" $\"%1$\""
or
WriteRegStr HKCU "Software\myApp\" "Somevar" '"ASDF" "%1"'
or
WriteRegStr HKCU "Software\myApp\" "Somevar" `"ASDF" "%1"`



You'll see the third variation used a lot in scripts as a backward quote is practically never used in plain writing or in parameters/arguments/etc. in command lines and other computer-related instances.
Animaether 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