All variables are global and can be used in Sections or Functions.
$VARNAME
User variables can be declared with the Var command. You can use these variables to store values, work with string manipulation etc. Unlike constants these variables are case-sensitive.
var_name
Declare a user variable. Allowed characters for variables names: [a-z][A-Z][0-9] and '_'.
$0, $1, $2, $3, $4, $5, $6, $7, $8, $9, $R0, $R1, $R2, $R3, $R4, $R5, $R6, $R7, $R8, $R9
Registers. These variables can be used just like user variables, but are usually used in shared functions or macro's. You don't have to declare these variables, so you won't get any name conflicts when using them in shared code. When using these variables in shared code, it's recommended that you use the stack to save and restore their original values. These variables can also be used for communication with plug-ins, because they can be read and written by the plug-in DLL's.
$INSTDIR
The installation directory ($INSTDIR is modifiable using StrCpy, ReadRegStr, ReadINIStr, etc. - This could be used, for example, in the .onInit function to do a more advanced detection of install location).
$OUTDIR
The current output directory (set implicitly via SetOutPath or explicitly via StrCpy, ReadRegStr, ReadINIStr, etc)
$CMDLINE
The command line of the installer. The format of the command line can be one of the following:
$LANGUAGE
The identifier of the language that is currently used. For example, English is 1033. You can change this variable in .onInit.
Constants can also be used in the InstallDir attribute.
Note that some of the new constants will not work on every OS. For example, $CDBURN_AREA will only work on Windows XP and above. If it's used on Windows 98, it'll be empty. Unless mentioned otherwise, a constant should be available on every OS.
$PROGRAMFILES
The program files directory (usually C:\Program Files but detected at runtime).
$COMMONFILES
The common files directory. This is a directory for components that are shared across applications (usually C:\Program Files\Common Files but detected at runtime).
$DESKTOP
The windows desktop directory (usually C:\windows\desktop but detected at runtime). The context of this constant (All Users or Current user) depends on the SetShellVarContext setting. The default is the current user.
$EXEDIR
The location of the installer executable. (technically you can modify this variable, but it is probably not a good idea)
${NSISDIR}
A symbol that contains the path where NSIS is installed. Detected at compile time. Useful if you want to call resources that are in NSIS directory e.g. Icons, UIs...
$WINDIR
The windows directory (usually C:\windows or C:\winnt but detected at runtime)
$SYSDIR
The windows system directory (usually C:\windows\system or C:\winnt\system32 but detected at runtime)
$TEMP
The system temporary directory (usually C:\windows\temp but detected at runtime)
$STARTMENU
The start menu folder (useful in adding start menu items using CreateShortCut). The context of this constant (All Users or Current user) depends on the SetShellVarContext setting. The default is the current user.
$SMPROGRAMS
The start menu programs folder (use this whenever you want $STARTMENU\Programs). The context of this constant (All Users or Current user) depends on the SetShellVarContext setting. The default is the current user.
$SMSTARTUP
The start menu programs / startup folder. The context of this constant (All Users or Current user) depends on the SetShellVarContext setting. The default is the current user.
$QUICKLAUNCH
The quick launch folder for IE4 active desktop and above. If quick launch is not available, simply returns the same as $TEMP.
$DOCUMENTS
The documents directory. A typical path for the current user is C:\Documents and Settings\Foo\My Documents. The context of this constant (All Users or Current user) depends on the SetShellVarContext setting. The default is the current user.
This constant is not available on Windows 95 with Internet Explorer 4 not installed.
$SENDTO
The directory that contains Send To menu shortcut items.
$RECENT
The directory that contains shortcuts to the user's recently used documents.
$FAVORITES
The directory that contains shortcuts to the user's favorite websites, documents, etc. The context of this constant (All Users or Current user) depends on the SetShellVarContext setting. The default is the current user.
This constant is not available on Windows 95 with Internet Explorer 4 not installed.
$MUSIC
The user's music files directory. The context of this constant (All Users or Current user) depends on the SetShellVarContext setting. The default is the current user.
This constant is available on Windows XP, ME and above.
$PICTURES
The user's picture files directory. The context of this constant (All Users or Current user) depends on the SetShellVarContext setting. The default is the current user.
This constant is available on Windows 2000, XP, ME and above.
$VIDEOS
The user's video files directory. The context of this constant (All Users or Current user) depends on the SetShellVarContext setting. The default is the current user.
This constant is available on Windows XP, ME and above.
$NETHOOD
The directory that contains link objects that may exist in the My Network Places/Network Neighborhood folder.
This constant is not available on Windows 95 with Internet Explorer 4 and Active Desktop not installed.
$FONTS
The system's fonts directory.
$TEMPLATES
The document templates directory. The context of this constant (All Users or Current user) depends on the SetShellVarContext setting. The default is the current user.
$APPDATA
The application data directory. Detection of the current user path requires Internet Explorer 4 and above. Detection of the all users path requires Internet Explorer 5 and above. The context of this constant (All Users or Current user) depends on the SetShellVarContext setting. The default is the current user.
This constant is not available on Windows 95 with Internet Explorer 4 and Active Desktop not installed.
$PRINTHOOD
The directory that contains link objects that may exist in the Printers folder.
This constant is not available on Windows 95 and Windows 98.
$INTERNET_CACHE
Internet Explorer's temporary internet files directory.
This constant is not available on Windows 95 and Windows NT with Internet Explorer 4 and Active Desktop not installed.
$COOKIES
Internet Explorer's cookies directory.
This constant is not available on Windows 95 and Windows NT with Internet Explorer 4 and Active Desktop not installed.
$HISTORY
Internet Explorer's history directory.
This constant is not available on Windows 95 and Windows NT with Internet Explorer 4 and Active Desktop not installed.
$PROFILE
The user's profile directory. A typical path is C:\Documents and Settings\Foo.
This constant is available on Windows 2000 and above.
$ADMINTOOLS
A directory where administrative tools are kept. The context of this constant (All Users or Current user) depends on the SetShellVarContext setting. The default is the current user.
This constant is available on Windows 2000, ME and above.
$RESOURCES
The resources directory that stores themes and other Windows resources (usually C:\Windows\Resources but detected at runtime).
This constant is available on Windows XP and above.
$RESOURCES_LOCALIZED
The localized resources directory that stores themes and other Windows resources (usually C:\Windows\Resources\1033 but detected at runtime).
This constant is available on Windows XP and above.
$CDBURN_AREA
A directory where files awaiting to be burned to CD are stored.
This constant is available on Windows XP and above.
$HWNDPARENT
The decimal HWND of the parent window.
$PLUGINSDIR
The path to a temporary folder created upon the first usage of a plugin or a call to InitPluginsDir. This folder is automatically deleted when the installer exits. This makes this folder the ideal folder to hold INI files for InstallOptions, bitmaps for the splash plugin, or any other file that a plugin needs to work.
$$
Use to represent $.
$\r
Use to represent a carriage return (\r).
$\n
Use to represent a newline (\n).
$\t
Use to represent a tab (\t).
${SYMBOL}
Where SYMBOL is the name of something globally defined, this will be replaced with the value of that symbol. The order of calling Symbols in the script is important.
Name "Test Program ${VERSION}" !define VERSION "V.1.0"
This code will set the name of the installer to "Test Program ${VERSION}". The Same happens if the Symbol has not been defined.
!define VERSION "V.1.0" Name "Test Program ${VERSION}"
This code sets the name of the installer to "Test Program V.1.0"
For more info, see Conditional Compilation.