NSIS中的系统路径常量

 分类:NSIS 阅读 (13,812)  Add comments
12月 032012
 

$PROGRAMFILES, $PROGRAMFILES32, $PROGRAMFILES64

The program files directory (usually C:Program Files but 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 FilesCommon Files but detected at runtime). On Windows x64, $COMMONFILES and $COMMONFILES32 point to C:Program Files (x86)Common Files while $COMMONFILES64 points to C:Program FilesCommon Files. Use $COMMONFILES64 when installing x64 applications.

$DESKTOP

The Windows desktop directory (usually C:WindowsDesktop 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 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.3 for more info.

$WINDIR

The Windows directory (usually C:Windows or C:WinNT but detected at runtime).

$SYSDIR

The Windows system directory (usually C:WindowsSystem or C:WinNTSystem32 but detected at runtime).

$TEMP

The system temporary directory (usually C:WindowsTemp 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 $STARTMENUPrograms). 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 SettingsFooMy 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.

$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 SettingsFoo.

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:WindowsResources 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:WindowsResources1033 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 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.

Values work on Windows XP system user tester,在Windows Xp中登录用户为tester时的一些常量值

Values work on Windows7 64bit, system user ldr,在64位Windows7 中登录用户为ldr时的一些常量值

Values work on Windows 7 64bit, system user administrator,在64位Windows 7中登录用户为administrator时的一些常量值

 

I modified from a NSIS example script to show the above variables,运行此脚本可以生成一个在你系统上的常量值列表。

 注意*******************************:

1. 对于有些系统路径NSIS是没有相关的常量值的,如果你在几种操作系统上检查此路径全部一样的话,可以用此路径的绝对路径来处理。
2. For the folders with system account name, if you want to store data to the corresponding folders for ALL USERS, you an use a micro  SetShellVarContext all (in Function .onInit)
对于目录中带有当前用户的目录,如果你想把数据存到All Users的相应目录下,使用宏 SetShellVarContext all(在Function .onInit中)进行转换,SetShellVarContext current为切换到当前用户相应目录

 

打赏