tests/nsis3/share/doc/nsis/Docs/Chapter3.html

Summary

Maintainability
Test Coverage
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>

<head>
<title>Command Line Usage</title>
<meta name="generator" content="Halibut v1.0 (NSIS Custom Build, SVN:r6192) xhtml-backend" />
<link rel="stylesheet" href="style.css" type='text/css' />
</head>

<body>
<p><a href='Chapter2.html'>Previous</a> | <a href='Contents.html'>Contents</a> | <a href='Chapter4.html'>Next</a></p>
<ul>
<li><a class="btitle" href="Chapter3.html#"><b>Chapter 3: </b>Command Line Usage</a></li>
<ul>
<li><a href="Chapter3.html#usage">MakeNSIS Usage</a></li>
<ul>
<li><a href="Chapter3.html#usagereference">Options</a></li>
<li><a href="Chapter3.html#usagenotes">Notes</a></li>
<li><a href="Chapter3.html#usageenvironment">Environment variables</a></li>
<li><a href="Chapter3.html#usageexamples">Examples</a></li>
</ul>
<li><a href="Chapter3.html#installerusage">Installer Usage</a></li>
<ul>
<li><a href="Chapter3.html#installerusagecommon">Common Options</a></li>
<li><a href="Chapter3.html#installerusageuninstaller">Uninstaller Specific Options</a></li>
<li><a href="Chapter3.html#installerusageexamples">Examples</a></li>
</ul>
</ul>
</ul>
<a name="cmdlineusage"></a><h1>Chapter 3: Command Line Usage</h1>
<a name="usage"></a><h2>3.1 MakeNSIS Usage</h2>

<p>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'.</p>

<p>If you want to use MakeNSIS on the command line, the syntax of makensis is:</p>
<pre>makensis [ option | script.nsi | - ] [...]
</pre>
<a name="usagereference"></a><h3>3.1.1 Options</h3>
<ul>
<li>/LICENSE displays license information.</li><li>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.</li><li>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.</li><li>The /O switch followed by a filename tells the compiler to print its log to that file (instead of the screen)</li><li>/PAUSE makes makensis pause before quitting, which is useful when executing directly from Windows.</li><li>/NOCONFIG disables inclusion of nsisconf.nsh. Without this parameter, installer defaults are set from nsisconf.nsh.</li><li>/CMDHELP prints basic usage information for command (if specified), or all commands (if command is not specified).</li><li>/HDRINFO prints information about which options were used to compile makensis.</li><li>/NOCD disables the current directory change to that of the .nsi file</li><li>/INPUTCHARSET allows you to specify a specific codepage for files without a BOM. (ACP|OEM|CP#|UTF8|UTF16&lt;LE|BE&gt;)</li><li>/OUTPUTCHARSET allows you to specify the codepage used by stdout when the output is redirected. (ACP|OEM|CP#|UTF8[SIG]|UTF16&lt;LE|BE&gt;[BOM])</li><li>/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.</li><li>/WX treats warnings as errors</li><li>Using the /D switch one or more times will add to symbols to the globally defined list (See !define).</li><li>Using the /X switch one or more times will execute the code you specify following it. Example: &quot;/XAutoCloseWindow false&quot;</li><li>Specifying a dash (-) for the script name will tell makensis to use the standard input as a source.</li></ul>
<a name="usagenotes"></a><h3>3.1.2 Notes</h3>
<ul>
<li>Parameters are processed in order. <code>makensis /Ddef script.nsi</code> is not the same as <code>makensis script.nsi /Ddef</code>.</li><li>If multiple scripts are specified, they are treated as one concatenated script.</li></ul>
<a name="usageenvironment"></a><h3>3.1.3 Environment variables</h3>

<p>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:</p>
<ul>
<li>NSISDIR, NSISCONFDIR - Places where nsis data and config files are installed. NSISDIR alters the script variable ${NSISDIR}. See <a href="Chapter4.html#varconstant">section 4.2.3</a> for more info.</li><li>APPDATA (on Windows) or HOME (on other platforms) - Location of the per-user configuration file.</li></ul>
<a name="usageexamples"></a><h3>3.1.4 Examples</h3>

<p>Basic usage:</p>
<pre>makensis.exe myscript.nsi
</pre>

<p>Quiet mode:</p>
<pre>makensis.exe /V1 myscript.nsi
</pre>

<p>Force compressor:</p>
<pre>makensis.exe /X&quot;SetCompressor /FINAL lzma&quot; myscript.nsi
</pre>

<p>Change script behavior:</p>
<pre>makensis.exe /DUSE_UPX /DVERSION=1.337 /DNO_IMAGES myscript.nsi
</pre>

<p>Parameters order:</p>
<pre>makensis /XSection sectioncontents.nsi /XSectionEnd
</pre>
<a name="installerusage"></a><h2>3.2 Installer Usage</h2>

<p>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.</p>
<a name="installerusagecommon"></a><h3>3.2.1 Common Options</h3>
<ul>
<li>/NCRC disables the CRC check, unless <a href="Chapter4.html#acrccheck"><code>CRCCheck</code></a><code> force</code> was used in the script.</li><li>/S runs the installer or uninstaller silently. See <a href="Chapter4.html#silent">section 4.12</a> for more information.</li><li>/D sets the default installation directory (<a href="Chapter4.html#varother">$INSTDIR</a>), overriding <a href="Chapter4.html#ainstalldir">InstallDir</a> and <a href="Chapter4.html#ainstalldirregkey">InstallDirRegKey</a>. 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.</li></ul>
<a name="installerusageuninstaller"></a><h3>3.2.2 Uninstaller Specific Options</h3>
<ul>
<li>_?= sets $INSTDIR. It also stops the uninstaller from copying itself to the temporary directory and running from there. It can be used along with <a href="Chapter4.html#execwait">ExecWait</a> 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.</li></ul>
<a name="installerusageexamples"></a><h3>3.2.3 Examples</h3>
<pre>installer.exe /NCRC
</pre>
<pre>installer.exe /S
</pre>
<pre>installer.exe /D=C:\Program Files\NSIS
</pre>
<pre>installer.exe /NCRC /S /D=C:\Program Files\NSIS
</pre>
<pre>uninstaller.exe /S _?=C:\Program Files\NSIS
</pre>
<pre># uninstall old version
ExecWait '&quot;$INSTDIR\uninstaller.exe&quot; /S _?=$INSTDIR'
</pre>
<p><a href='Chapter2.html'>Previous</a> | <a href='Contents.html'>Contents</a> | <a href='Chapter4.html'>Next</a></p>

<hr />

<address>
</address>
</body>

</html>