Skip to content
⌘ NSIS Forum Archive

Write quote charachter in registry

4 posts

Zoroxeus#

Write quote charachter in registry

Hi,
I am very new to NSIS ...
I have been reverse engineering [like the rest of my life 🙂 ] various samples and trying to find my way.
So far it's been fairly straighforward but I need to write the following Reg_Expand_Sz key in my registry:
Name: ImagePath
Value: "C:\mysql\bin\mysqld" --defaults-file="C:\mysql\my.ini" MySQL"

[Value is as it is, ie with the quote charchater]

What would be the way please?

WriteRegExpandStr HKLM "SYSTEM\ControlSet001\Services\MySQL" "ImagePath" "$\"C:\mysql\bin\mysqld$\" --defaults-file=$\"C:\mysql\my.ini$\" MySQL"


?

Thanks
MSG#
simply wrap the string in different quotes:

WriteRegExpandStr HKLM "SYSTEM\ControlSet001\Services\MySQL" "ImagePath" 'C:\mysql\bin\mysqld" --defaults-file="C:\mysql\my.ini" MySQL'
Zoroxeus#
Thanks MSG
Did you mean:

WriteRegExpandStr HKLM "SYSTEM\ControlSet001\Services\MySQL" "ImagePath" '" C:\mysql\bin\mysqld" --defaults-file="C:\mysql\my.ini" MySQL'

?

So does that mean that NSIS maker at compile time looks at different scenarios ?

As well why the $\ escpae would not work ?

Thanks for the infos
Zinthose#
That is correct..

NSIS can parse strings with the following characters:
"
'
`
## Examples:
"String One"
'String Two'
`String Three` 
Personally I typically use the ` character as it is very rare and it is unlikely to cause parsing with !defines