The format of the command line can be one of the following: The current output directory (set implicitly via SetOutPath or explicitly via StrCpy, ReadRegStr, ReadINIStr, etc) If you write the uninstaller to another location, you should keep the installer's $INSTDIR in the registry or an alternative storing facility and read it in the uninstaller. For example, if you write the uninstaller to $WINDIR and the user doesn't move it, $INSTDIR will be $WINDIR in the uninstaller. It does not necessarily contain the same value it contained in the installer. Note that in uninstaller code, $INSTDIR contains the directory where the uninstaller lies.
onInit function to do a more advanced detection of install location). This could be used, for example, in the.
The installation directory ($INSTDIR is modifiable using StrCpy, ReadRegStr, ReadINIStr, etc.
These variables can also be used for communication with plug-ins because they can be read and written by the plug-in DLLs.
When using these variables in shared code it's recommended that you use the stack to save and restore their original values. You don't have to declare these variables so you won't get any name conflicts when using them in shared code. These variables can be used just like user variables, but are usually used in shared functions or macros. The /GLOBAL flag is not required outside of sections and functions. To make this clear, variables defined in a section or a function must use the /GLOBAL flag. All defined variables are global, even if defined in a section or a function. Allowed characters for variables names:, '.' and '_'. 4.2.1.1 Var var_nameĭeclare a user variable. You can use these variables to store values, work with string manipulation etc. User variables must be declared with the Var command. To extend this limit, build NSIS with a bigger value of the NSIS_MAX_STRLEN build setting or use the special build. Note that by default, variables are limited to 1024 characters. 4.2 VariablesĪll variables are global and can be used in Sections or Functions. You can alter this at runtime, see section 3.1.3 for more information. On other platforms this is set at install time and defaults to $PREFIX/etc/.
The config directory on Windows is the same directory as makensis.exe is in. If a file named "nsisconf.nsh" in the config directory exists, it will be included by default before any scripts (unless the /NOCONFIG command line parameter is used). !error "MESSAGE not defined, cannot continue!" # A comment \Ĭompiler commands start with a ! and are executed at compile time. It can be a bit confusing, so it should be avoided. Line extension for long commands works for comments as well. (If you have anything you created that you want \ "Do you want to remove all files in the folder? \ For example: CreateShortcut "$SMPROGRAMS\NSIS\ZIP2EXE project workspace.lnk" \ The next line will effectively be concatenated to the end of it. To extend a command over multiple lines, use a backslash (\) at the end of the line. It is also possible to put newlines, tabs etc. MessageBox MB_OK "$\"A quote from a wise man$\" said the wise man" this one shows escaping of quotes MessageBox MB_OK `And he said to me "I'll be happy!"` this one puts both ' and "s inside a string MessageBox MB_OK 'And he said to me "Hi there!"' this one puts a " inside a string You can escape quotes using $\: MessageBox MB_OK "I'll be happy" this one puts a ' inside a string
They can be either single quotes, double quotes, or the backward single quote. Quotes only have the property of containing a parameter if they surround the rest of the parameter. To represent strings that have spaces, use quotes: MessageBox MB_OK "Hi there!" 0x12345AB), or octal (numbers beginning with a 0 and no x).Ĭolors should be set in hexadecimal RGB format, like HTML but without the #. nsExec::Exec "myfile"įor parameters that are treated as numbers, use decimal (the number) or hexadecimal (with 0x prepended to it, i.e. To call a plug-in, use 'plugin::command '. If you want a parameter to start with or # put it in quotes. CommentĪnother comment line (see `Long commands` section below) You can also use C-style comments to comment one or more lines. Chapter 4: Scripting Reference 4.1 Script File FormatĪ NSIS Script File (.nsi) is just a text file with script code.Ĭommands lines are in the format 'command ' File "myfile"