MakeNSIS Usage

NSIS

Previous | Contents | Next

3.1 MakeNSIS Usage

NSIS installers are generated by using the 'MakeNSIS' program to compile a NSIS script (.NSI) into an installer executable. The NSIS development kit installer sets up your computer so that you can compile a .nsi file by simply right-clicking on it in Explorer and selecting 'compile'.

If you want to use MakeNSIS on the command line, the syntax of makensis is:

makensis [ option | script.nsi | - ] [...]

3.1.1 Options

  • /LICENSE displays license information.
  • The /V switch followed by a number between 0 and 4 will set the verbosity of output accordingly. 0=no output, 1=errors only, 2=warnings and errors, 3=info, warnings, and errors, 4=all output.
  • The /P switch followed by a number between 0 and 5 will set the priority of the compiler process accordingly. 0=idle, 1=below normal, 2=normal (default), 3=above normal, 4=high, 5=realtime.
  • The /O switch followed by a filename tells the compiler to print its log to that file (instead of the screen)
  • /PAUSE makes makensis pause before quitting, which is useful when executing directly from Windows.
  • /NOCONFIG disables inclusion of nsisconf.nsh. Without this parameter, installer defaults are set from nsisconf.nsh.
  • /CMDHELP prints basic usage information for command (if specified), or all commands (if command is not specified).
  • /HDRINFO prints information about which options were used to compile makensis.
  • /NOCD disables the current directory change to that of the .nsi file
  • /INPUTCHARSET allows you to specify a specific codepage for files without a BOM. (ACP|OEM|CP#|UTF8|UTF16<LE|BE>)
  • /OUTPUTCHARSET allows you to specify the codepage used by stdout when the output is redirected. (ACP|OEM|CP#|UTF8[SIG]|UTF16<LE|BE>[BOM])
  • /PPO or /SAFEPPO will only run the preprocessor and print the result to stdout. The safe version will not execute instructions like !appendfile or !system. !packhdr and !finalize are never executed.
  • /WX treats warnings as errors
  • Using the /D switch one or more times will add to symbols to the globally defined list (See !define).
  • Using the /X switch one or more times will execute the code you specify following it. Example: "/XAutoCloseWindow false"
  • Specifying a dash (-) for the script name will tell makensis to use the standard input as a source.

3.1.2 Notes

  • Parameters are processed in order. makensis /Ddef script.nsi is not the same as makensis script.nsi /Ddef.
  • If multiple scripts are specified, they are treated as one concatenated script.

3.1.3 Environment variables

makensis checks a number of environment variables that tell it where to locate the things it needs in order to create installers. These variables include:

  • NSISDIR, NSISCONFDIR - Places where nsis data and config files are installed. NSISDIR alters the script variable ${NSISDIR}. See section 4.2.3 for more info.
  • APPDATA (on Windows) or HOME (on other platforms) - Location of the per-user configuration file.

3.1.4 Examples

Basic usage:

makensis.exe myscript.nsi

Quiet mode:

makensis.exe /V1 myscript.nsi

Force compressor:

makensis.exe /X"SetCompressor /FINAL lzma" myscript.nsi

Change script behavior:

makensis.exe /DUSE_UPX /DVERSION=1.337 /DNO_IMAGES myscript.nsi

Parameters order:

makensis /XSection sectioncontents.nsi /XSectionEnd

Previous | Contents | Next