NSIS Home > NSIS Discussion Forum > NSIS Archive > NSIS Programmer's Reference
  NSIS Programmer's Reference

  Script file format

This describes how to write the script.



Instructions

Instructions and attributes are written in the following form:

command [parameters]

Each instruction and/or attribute is written at the beginning of a line.

Parameters are separated by a single space. To keep a sentence containing spaces together, use quotes.



Comments

Comments are written in the following form:

#comment

or

;comment

A comment can start anywhere in a line, and continues untill the end of the line.

A comment starts always with a # or ;, where it is not used in a parameter (e.g. between quotes or in a string).



Quotes

Quotes can contain spaces, # and ; and other quotes. You can use double quotes ("..."), single quotes ('...') or backward single quotes (`...`).

A sentence started with a particular quote has to end with that quote.

In a within quotes contained sentence, quotes, other than the ones that the sentence is contained in, can be used. For example:

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.

When you want to use the same quotes as those that the sentence is contained in, you'll have to escape them. Escaping quotes is done by putting $\ in front of the quote. For example:

MessageBox MB_OK "$\"A quote from a wise man$\" said the wise man"    ; This one shows escaping of quotes.


Plugins

Plugin calls are written in the following form:

plugin::command [/NOUNLOAD] [parameters]

plugin is the name part of the plugin DLL's name. command is the plugin's function that you want to call.

When you don't want the plugin to unload after usage, specify the /NOUNLOAD switch.

Read the plugin's documentation for more information about the functions and parameters that the plugin supports.



Numbers

Numbers can be written in the following forms:

[0x|0]number

For parameters that are treated as numbers, you can write them numeric (i.e. 3735928559), hexadecimal (prepended with 0x, i.e. 0xDEADBEEF) or octal (prepended with 0, i.e. 033653337357).


See Also

SetPluginUnload instruction