| 1 |
\C{cmdlineusage} Command Line Usage |
| 2 |
|
| 3 |
\H{usage} MakeNSIS Usage |
| 4 |
|
| 5 |
NSIS installers are generated by using the 'MakeNSIS' program to compile a NSIS script (.NSI) into an installer executable. |
| 6 |
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'. |
| 7 |
|
| 8 |
If you want to use MakeNSIS on the command line, the syntax of makensis is: |
| 9 |
|
| 10 |
\c makensis [ option | script.nsi | - ] [...] |
| 11 |
|
| 12 |
\S1{usagereference} Options |
| 13 |
|
| 14 |
\b /LICENSE displays license information. |
| 15 |
|
| 16 |
\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. |
| 17 |
|
| 18 |
\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. |
| 19 |
|
| 20 |
\b The /O switch followed by a filename tells the compiler to print its log to that file (instead of the screen) |
| 21 |
|
| 22 |
\b /LAUNCH executes the generated installer. |
| 23 |
|
| 24 |
\b /PAUSE makes makensis pause before quitting, which is useful when executing directly from Windows. |
| 25 |
|
| 26 |
\b /NOCONFIG disables inclusion of nsisconf.nsh. Without this parameter, installer defaults are set from nsisconf.nsh. |
| 27 |
|
| 28 |
\b /CMDHELP prints basic usage information for command (if specified), or all commands (if command is not specified). |
| 29 |
|
| 30 |
\b /HDRINFO prints information about which options were used to compile makensis. |
| 31 |
|
| 32 |
\b /NOCD disables the current directory change to that of the .nsi file |
| 33 |
|
| 34 |
\b /INPUTCHARSET allows you to specify a specific codepage for files without a BOM. (\NsisInputCharset) |
| 35 |
|
| 36 |
\b /OUTPUTCHARSET allows you to specify the codepage used by stdout when the output is redirected. (\NsisOutputCharset) |
| 37 |
|
| 38 |
\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. |
| 39 |
|
| 40 |
\b /WX treats warnings as errors |
| 41 |
|
| 42 |
\b Using the /D switch one or more times will add to symbols to the globally defined list (See !define). |
| 43 |
|
| 44 |
\b Using the /X switch one or more times will execute the code you specify following it. Example: "/XAutoCloseWindow false" |
| 45 |
|
| 46 |
\b Specifying a dash (-) for the script name will tell makensis to use the standard input as a source. |
| 47 |
|
| 48 |
\S1{usagenotes} Notes |
| 49 |
|
| 50 |
\b Parameters are processed in order. \c{makensis /Ddef script.nsi} is not the same as \c{makensis script.nsi /Ddef}. |
| 51 |
|
| 52 |
\b If multiple scripts are specified, they are treated as one concatenated script. |
| 53 |
|
| 54 |
\S1{usageenvironment} Environment variables |
| 55 |
|
| 56 |
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: |
| 57 |
|
| 58 |
\b NSISDIR, NSISCONFDIR - Places where nsis data and config files are installed. NSISDIR alters the script variable $\{NSISDIR\}. See \k{varconstant} for more info. |
| 59 |
|
| 60 |
\b APPDATA (on Windows) or HOME (on other platforms) - Location of the per-user configuration file. |
| 61 |
|
| 62 |
\S1{usageexamples} Examples |
| 63 |
|
| 64 |
Basic usage: |
| 65 |
|
| 66 |
\c makensis.exe myscript.nsi |
| 67 |
|
| 68 |
Quiet mode: |
| 69 |
|
| 70 |
\c makensis.exe /V1 myscript.nsi |
| 71 |
|
| 72 |
Force compressor: |
| 73 |
|
| 74 |
\c makensis.exe /X"SetCompressor /FINAL lzma" myscript.nsi |
| 75 |
|
| 76 |
Change script behavior: |
| 77 |
|
| 78 |
\c makensis.exe /DUSE_UPX /DVERSION=1.337 /DNO_IMAGES myscript.nsi |
| 79 |
|
| 80 |
Parameters order: |
| 81 |
|
| 82 |
\c makensis /XSection sectioncontents.nsi /XSectionEnd |
| 83 |
|
| 84 |
\H{installerusage} Installer Usage |
| 85 |
|
| 86 |
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. |
| 87 |
|
| 88 |
\S1{installerusagecommon} Common Options |
| 89 |
|
| 90 |
\b /NCRC disables the CRC check, unless \c{\R{acrccheck}{CRCCheck} force} was used in the script. |
| 91 |
|
| 92 |
\b /S runs the installer or uninstaller silently. See \k{silent} for more information. |
| 93 |
|
| 94 |
\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. |
| 95 |
|
| 96 |
\S1{installerusageuninstaller} Uninstaller Specific Options |
| 97 |
|
| 98 |
\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. |
| 99 |
|
| 100 |
\S1{installerusageexamples} Examples |
| 101 |
|
| 102 |
\c installer.exe /NCRC |
| 103 |
|
| 104 |
\c installer.exe /S |
| 105 |
|
| 106 |
\c installer.exe /D=C:\Program Files\NSIS |
| 107 |
|
| 108 |
\c installer.exe /NCRC /S /D=C:\Program Files\NSIS |
| 109 |
|
| 110 |
\c uninstaller.exe /S _?=C:\Program Files\NSIS |
| 111 |
|
| 112 |
\c # uninstall old version |
| 113 |
\c ExecWait '"$INSTDIR\uninstaller.exe" /S _?=$INSTDIR' |
| 114 |
\c Delete "$INSTDIR\uninstaller.exe" |
| 115 |
\c RMDir $INSTDIR |