NSIS How to split strings over multiple lines?
Asked Answered
L

1

13

Seems like a simple one, but I have a large command line help string and would like to break it up so it's easier to read/maintain.

How can I do this in NSIS? The normal

"xxx" \
"xxxx"

style method of doing this doesn't seem to work.

Example code I want to neaten up:

MessageBox MB_OK "Unattended Silent Installs:$\r$\n/S$\t$\t=$\tSilent install using install.ini (if present)$\r$\n/W=1$\t$\t=$\t\Writes out all user settings to install.ini$\r$\n/WRITESETTINGS=1$\t$\t=$\tWrites out all user settings to install.ini (longer form)$\r$\n/?$\t$\t=$\tThis help page.$\r$\n$\r$\n"

Luiseluiza answered 18/5, 2011 at 7:16 Comment(0)
P
18

The \ is inside the quotes:

MessageBox MB_OK "Unattended Silent Installs:$\r$\n\
    /S$\t$\t=$\tSilent install using install.ini (if present)$\r$\n\
    /W=1$\t$\t=$\t\Writes out all user settings to install.ini$\r$\n\
    /WRITESETTINGS=1$\t$\t=$\tWrites out all user settings to install.ini (longer form)$\r$\n\
    /?$\t$\t=$\tThis help page.$\r$\n\
    $\r$\n"

Alternatively you can use defines:

!define msg1 "foo$\r$\n"
!define msg2 "bar$\r$\n"
MessageBox MB_OK "${msg1}${msg2}"
Piccalilli answered 18/5, 2011 at 19:3 Comment(1)
Thanks Anders - hadn't expected it to go inside the quote ;)Luiseluiza

© 2022 - 2024 — McMap. All rights reserved.