Chapter3.html 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns='http://www.w3.org/1999/xhtml'>
  4. <head>
  5. <title>Command Line Usage</title>
  6. <meta name="generator" content="Halibut v1.0 (NSIS Custom Build, SVN:r?) xhtml-backend" />
  7. <link rel="stylesheet" href="style.css" type='text/css' />
  8. </head>
  9. <body>
  10. <p><a href='Chapter2.html'>Previous</a> | <a href='Contents.html'>Contents</a> | <a href='Chapter4.html'>Next</a></p>
  11. <ul>
  12. <li><a class="btitle" href="Chapter3.html#"><b>Chapter 3: </b>Command Line Usage</a></li>
  13. <ul>
  14. <li><a href="Chapter3.html#usage">MakeNSIS Usage</a></li>
  15. <ul>
  16. <li><a href="Chapter3.html#usagereference">Options</a></li>
  17. <li><a href="Chapter3.html#usagenotes">Notes</a></li>
  18. <li><a href="Chapter3.html#usageenvironment">Environment variables</a></li>
  19. <li><a href="Chapter3.html#usageexamples">Examples</a></li>
  20. </ul>
  21. <li><a href="Chapter3.html#installerusage">Installer Usage</a></li>
  22. <ul>
  23. <li><a href="Chapter3.html#installerusagecommon">Common Options</a></li>
  24. <li><a href="Chapter3.html#installerusageuninstaller">Uninstaller Specific Options</a></li>
  25. <li><a href="Chapter3.html#installerusageexamples">Examples</a></li>
  26. </ul>
  27. </ul>
  28. </ul>
  29. <a name="cmdlineusage"></a><h1>Chapter 3: Command Line Usage</h1>
  30. <a name="usage"></a><h2>3.1 MakeNSIS Usage</h2>
  31. <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>
  32. <p>If you want to use MakeNSIS on the command line, the syntax of makensis is:</p>
  33. <pre>makensis [ option | script.nsi | - ] [...]
  34. </pre>
  35. <a name="usagereference"></a><h3>3.1.1 Options</h3>
  36. <ul>
  37. <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>
  38. <a name="usagenotes"></a><h3>3.1.2 Notes</h3>
  39. <ul>
  40. <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>
  41. <a name="usageenvironment"></a><h3>3.1.3 Environment variables</h3>
  42. <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>
  43. <ul>
  44. <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>
  45. <a name="usageexamples"></a><h3>3.1.4 Examples</h3>
  46. <p>Basic usage:</p>
  47. <pre>makensis.exe myscript.nsi
  48. </pre>
  49. <p>Quiet mode:</p>
  50. <pre>makensis.exe /V1 myscript.nsi
  51. </pre>
  52. <p>Force compressor:</p>
  53. <pre>makensis.exe /X&quot;SetCompressor /FINAL lzma&quot; myscript.nsi
  54. </pre>
  55. <p>Change script behavior:</p>
  56. <pre>makensis.exe /DUSE_UPX /DVERSION=1.337 /DNO_IMAGES myscript.nsi
  57. </pre>
  58. <p>Parameters order:</p>
  59. <pre>makensis /XSection sectioncontents.nsi /XSectionEnd
  60. </pre>
  61. <a name="installerusage"></a><h2>3.2 Installer Usage</h2>
  62. <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>
  63. <a name="installerusagecommon"></a><h3>3.2.1 Common Options</h3>
  64. <ul>
  65. <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>
  66. <a name="installerusageuninstaller"></a><h3>3.2.2 Uninstaller Specific Options</h3>
  67. <ul>
  68. <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>
  69. <a name="installerusageexamples"></a><h3>3.2.3 Examples</h3>
  70. <pre>installer.exe /NCRC
  71. </pre>
  72. <pre>installer.exe /S
  73. </pre>
  74. <pre>installer.exe /D=C:\Program Files\NSIS
  75. </pre>
  76. <pre>installer.exe /NCRC /S /D=C:\Program Files\NSIS
  77. </pre>
  78. <pre>uninstaller.exe /S _?=C:\Program Files\NSIS
  79. </pre>
  80. <pre># uninstall old version
  81. ExecWait '&quot;$INSTDIR\uninstaller.exe&quot; /S _?=$INSTDIR'
  82. </pre>
  83. <p><a href='Chapter2.html'>Previous</a> | <a href='Contents.html'>Contents</a> | <a href='Chapter4.html'>Next</a></p>
  84. <hr />
  85. <address>
  86. </address>
  87. </body>
  88. </html>