Jesse
Jesse

Reputation: 175

NSIS How to split strings over multiple lines?

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"

Upvotes: 14

Views: 10360

Answers (1)

Anders
Anders

Reputation: 101666

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}"

Upvotes: 19

Related Questions