\C{cmdlineusage} Command Line Usage

\H{usage} 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 the makensis command is:

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

\S1{usagereference} Options

\b /LICENSE displays a keen license page.

\b 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.

\b 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.

\b The /O switch followed by a filename tells the compiler to print its log to that file (instead of the screen)

\b /PAUSE makes makensis pause before quitting, which is useful when executing directly from Windows.

\b /NOCONFIG disables inclusion of nsisconf.nsh. Without this parameter, installer defaults are set from nsisconf.nsh.

\b /CMDHELP prints basic usage information for command (if specified), or all commands (if command is not specified).

\b /HDRINFO prints out information on what options were used to compile makensis was compiled with.

\b /NOCD disables the current directory change to that of the .nsi file

\b /INPUTCHARSET allows you to specify a specific codepage for files without a BOM. (\NsisInputCharset)

\b /OUTPUTCHARSET allows you to specify the codepage used by stdout when the output is redirected. (\NsisOutputCharset)

\b /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.

\b /WX treats warnings as errors

\b Using the /D switch one or more times will add to symbols to the globally defined list (See !define).

\b Using the /X switch one or more times will execute the code you specify following it. Example: "/XAutoCloseWindow false"

\b Specifying a dash (-) for the script name will tell makensis to use the standard input as a source.

\S1{usagenotes} Notes

\b Parameters are processed by order. \c{makensis /Ddef script.nsi} is not the same as \c{makensis script.nsi /Ddef}.

\b If multiple scripts are specified, they are treated as one concatenated script.

\b On Windows 95, 98 and NT, below normal and above normal process priorities are not available. On those systems, below normal will actually set priority to idle and above normal will set to high.

\S1{usageenvironment} 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:

\b NSISDIR, NSISCONFDIR - Places where nsis data and config files are installed. NSISDIR alters the script variable $\{NSISDIR\}.  See \k{varconstant} for more info.

\b APPDATA (on Windows) or HOME (on other platforms) - Location of the per-user configuration file.

\S1{usageexamples} Examples

Basic usage:

\c makensis.exe myscript.nsi

Quiet mode:

\c makensis.exe /V1 myscript.nsi

Force compressor:

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

Change script behavior:

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

Parameters order:

\c makensis /XSection sectioncontents.nsi /XSectionEnd

\H{installerusage} Installer Usage

Generated installers and uninstallers accept a few options on the command line. These options give the user a bit more control over the installation process.

\S1{installerusagecommon} Common Options

\b /NCRC disables the CRC check, unless \c{\R{acrccheck}{CRCCheck} force} was used in the script.

\b /S runs the installer or uninstaller silently. See \k{silent} for more information.

\b /D sets the default installation directory (\R{varother}{$INSTDIR}), overriding \R{ainstalldir}{InstallDir} and \R{ainstalldirregkey}{InstallDirRegKey}. It must be the last parameter used in the command line and must not contain any quotes, even if the path contains spaces. Only absolute paths are supported.

\S1{installerusageuninstaller} Uninstaller Specific Options

\b _?= sets $INSTDIR. It also stops the uninstaller from copying itself to the temporary directory and running from there. It can be used along with \R{execwait}{ExecWait} to wait for the uninstaller to finish. It must be the last parameter used in the command line and must not contain any quotes, even if the path contains spaces.

\S1{installerusageexamples} Examples

\c installer.exe /NCRC

\c installer.exe /S

\c installer.exe /D=C:\Program Files\NSIS

\c installer.exe /NCRC /S /D=C:\Program Files\NSIS

\c uninstaller.exe /S _?=C:\Program Files\NSIS

\c # uninstall old version
\c ExecWait '"$INSTDIR\uninstaller.exe" /S _?=$INSTDIR'
