4.2.3 Constants
Constants can also be used in the InstallDirattribute.
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, \$PROGRAMFILES32, \$PROGRAMFILES64
The program files directory (usually C:\Program Filesbut detected at runtime).
On Windows x64, \$PROGRAMFILES and \$PROGRAMFILES32 point to C:\Program Files (x86) while \$PROGRAMFILES64 points to C:\Program Files.
Use \$PROGRAMFILES64 when installing x64 applications.
\$COMMONFILES, \$COMMONFILES32, \$COMMONFILES64
The common files directory.
This is a directory for components that are shared across applications (usually C:\Program Files\Common Filesbut detected at runtime).
On Windows x64, \$COMMONFILES and \$COMMONFILES32 point to C:\Program Files (x86)\Common Files while \$COMMONFILES64 points to C:\Program Files\Common Files.
Use \$COMMONFILES64 when installing x64 applications.
\$DESKTOP
The Windows desktop directory (usually C:\Windows\Desktopbut detected at runtime).
The context of this constant (All Users or Current user) depends on the SetShellVarContextsetting. The default is the current user.
$EXEDIR
The directory containing the installer executable (technically you can modify this variable, but it is probably not a good idea).
$EXEFILE
The base name of the installer executable.
$EXEPATH
The full path of the installer executable.
${NSISDIR}
A symbol that contains the path where NSIS is installed.
Useful if you want to call resources that are in NSIS directory e.g. Icons, UIs etc.
When compiled with support for keeping makensis and the data in the same place (the default on Windows),
it is in the same place as makensis, on other platforms it is set at compile time (See the INSTALL file for info).
In both instances you can modify it at runtime by setting the NSISDIR environment variable. See section 3.1.3for more info.
$WINDIR
The Windows directory (usually C:\Windowsor C:\WinNTbut detected at runtime).
$SYSDIR
The Windows system directory (usually C:\Windows\Systemor C:\WinNT\System32but detected at runtime).
$TEMP
The system temporary directory (usually C:\Windows\Tempbut 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 SetShellVarContextsetting. 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 SetShellVarContextsetting. 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 SetShellVarContextsetting. 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 SetShellVarContextsetting. 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 SetShellVarContextsetting. 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 SetShellVarContextsetting. 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 SetShellVarContextsetting. 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 SetShellVarContextsetting. 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 SetShellVarContextsetting. 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 SetShellVarContextsetting.
The default is the current user.
This constant is not available on Windows 95 with Internet Explorer 4 and Active Desktop not installed.
$LOCALAPPDATA
The local (nonroaming) application data directory.
This constant is available on Windows 2000 and above.
$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 SetShellVarContextsetting. 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\Resourcesbut 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\1033but 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 plug-in 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 plug-in, or any other file that a plug-in needs to work.
Constants can also be used in the InstallDirattribute.
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, \$PROGRAMFILES32, \$PROGRAMFILES64
The program files directory (usually C:\Program Filesbut detected at runtime).
On Windows x64, \$PROGRAMFILES and \$PROGRAMFILES32 point to C:\Program Files (x86) while \$PROGRAMFILES64 points to C:\Program Files.
Use \$PROGRAMFILES64 when installing x64 applications.
\$COMMONFILES, \$COMMONFILES32, \$COMMONFILES64
The common files directory.
This is a directory for components that are shared across applications (usually C:\Program Files\Common Filesbut detected at runtime).
On Windows x64, \$COMMONFILES and \$COMMONFILES32 point to C:\Program Files (x86)\Common Files while \$COMMONFILES64 points to C:\Program Files\Common Files.
Use \$COMMONFILES64 when installing x64 applications.
\$DESKTOP
The Windows desktop directory (usually C:\Windows\Desktopbut detected at runtime).
The context of this constant (All Users or Current user) depends on the SetShellVarContextsetting. The default is the current user.
$EXEDIR
The directory containing the installer executable (technically you can modify this variable, but it is probably not a good idea).
$EXEFILE
The base name of the installer executable.
$EXEPATH
The full path of the installer executable.
${NSISDIR}
A symbol that contains the path where NSIS is installed.
Useful if you want to call resources that are in NSIS directory e.g. Icons, UIs etc.
When compiled with support for keeping makensis and the data in the same place (the default on Windows),
it is in the same place as makensis, on other platforms it is set at compile time (See the INSTALL file for info).
In both instances you can modify it at runtime by setting the NSISDIR environment variable. See section 3.1.3for more info.
$WINDIR
The Windows directory (usually C:\Windowsor C:\WinNTbut detected at runtime).
$SYSDIR
The Windows system directory (usually C:\Windows\Systemor C:\WinNT\System32but detected at runtime).
$TEMP
The system temporary directory (usually C:\Windows\Tempbut 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 SetShellVarContextsetting. 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 SetShellVarContextsetting. 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 SetShellVarContextsetting. 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 SetShellVarContextsetting. 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 SetShellVarContextsetting. 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 SetShellVarContextsetting. 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 SetShellVarContextsetting. 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 SetShellVarContextsetting. 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 SetShellVarContextsetting. 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 SetShellVarContextsetting.
The default is the current user.
This constant is not available on Windows 95 with Internet Explorer 4 and Active Desktop not installed.
$LOCALAPPDATA
The local (nonroaming) application data directory.
This constant is available on Windows 2000 and above.
$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 SetShellVarContextsetting. 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\Resourcesbut 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\1033but 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 plug-in 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 plug-in, or any other file that a plug-in needs to work.
댓글
댓글 쓰기