4.8 Installer Attributes
4.8.1 General Attributes
The commands below all adjust attributes of the installer. These attributes control how the installer looks and functions, including which pages are present in the installer, which text is displayed in each part of each page, the name of the installer, the icon the installer uses, the default installation directory and more. Note that these attributes can be set anywhere in the file except in a Section or Function.
下面的命令调整安装程序的属性。这些属性控制安装程序的外观和功能,包括安装程序中出现哪些页面、每个页面的每个部分显示哪些文本、安装程序的名称、安装程序使用的图标、默认安装目录等等。注意,这些属性可以在文件的任何地方设置,除了Section或Function。
Defaults are bold and underlined
默认值是粗体
4.8.1.1 AddBrandingImage
AddBrandingImage (left|right|top|bottom) (width|height) [padding]
Adds a branding image on the top, bottom, left, or right of the installer. Its size will be set according to the width/height specified, the installer width/height and the installers font. The final size will not always be what you requested; have a look at the output of the command for the actual size. Because this depends on the installers font, you should use SetFont before AddBrandingImage. The default padding value is 2. The numbers can be suffixed with u to specify dialog units instead of pixels.
在安装程序的顶部、底部、左侧或右侧添加品牌图像。
AddBrandingImage only adds a placeholder for an image. To set the image itself at runtime, use SetBrandingImage.
AddBrandingImage仅为图像添加一个占位符。要在运行时设置图像本身,使用SetBrandingImage。
AddBrandingImage left 100
AddBrandingImage right 50
AddBrandingImage top 20u 3u
AddBrandingImage bottom 35
AddBrandingImage left 100 5
4.8.1.2 AllowRootDirInstall
AllowRootDirInstall true|false
Controls whether or not installs are allowed in the root directory of a drive, or directly into a network share. Set to 'true' to change the safe behavior, which prevents users from selecting C:\ or \\Server\Share as an install (and later on, uninstall) directory. For additional directory selection page customizability, see .onVerifyInstDir.
控制是否允许安装在驱动器的根目录中,或直接安装在网络共享中。
4.8.1.3 AutoCloseWindow
AutoCloseWindow true|false
Sets whether or not the install window automatically closes when completed. This is overrideable from a section using SetAutoClose.
设置安装窗口完成后是否自动关闭。可以通过使用条款中
SetAutoClose覆盖。
4.8.1.4 BGFont
BGFont [font_face [height [weight] [/ITALIC] [/UNDERLINE] [/STRIKE]]]
Specifies the font used to show the text on the background gradient. To set the color use BGGradient. The default font will be used if no parameters are specified. The default font is bold and italic Times New Roman.
指定用于在背景渐变上显示文本的字体。使用
BGGradient设置颜色。
4.8.1.5 BGGradient
BGGradient [off|(topc botc [textcolor|notext])]
Specifies whether or not to use a gradient background window. If 'off', the installer will not show a background window, if no parameters are specified, the default black to blue gradient is used, and otherwise the top_color or bottom_color are used to make a gradient. Top_color and bottom_color are specified using the form RRGGBB (in hexadecimal, as in HTML, only minus the leading '#', since # can be used for comments). 'textcolor' can be specified as well, or 'notext' can be specified to turn the big background text off.
指定是否使用渐变背景窗口。
4.8.1.6 BrandingText
BrandingText /TRIM(LEFT|RIGHT|CENTER) text
Sets the text that is shown at the bottom of the install window (by default it is 'Nullsoft Install System vX.XX'). Setting this to an empty string ("") uses the default; to set the string to blank, use " " (a space). If it doesn't matter to you, leave it the default so that everybody can know why the installer didn't suck :). Use /TRIMLEFT, /TRIMRIGHT or /TRIMCENTER to trim down the size of the control to the size of the string.
设置显示在安装窗口底部的文本(默认为“Nullsoft install System vX.XX”)。
Accepts variables. If variables are used, they must be initialized on .onInit.
接受变量。如果使用变量,则必须在
.oninit上初始化它们。
4.8.1.7 Caption
Caption caption
When used outside a PageEx block: Sets the text for the titlebar of the installer. By default it is $(^Name) Setup, where Name is specified by the Name instruction. You can however override it with 'MyApp Installer' or whatever. If you specify an empty string (""), the default will be used (you can specify " " to simulate a empty string).
当在
PageEx块外使用时,设置安装程序标题栏的文本。
When used inside a PageEx block: Sets the subcaption of the current page.
当在
PageEx块中使用时,设置当前页面的子标题。
Accepts variables. If variables are used, they must be initialized on .onInit or .onGUIInit.
接受变量。如果使用变量,则必须在
.onInit或.onGUIInit上初始化它们。
4.8.1.8 ChangeUI
ChangeUI dialog ui_file.exe
Replaces dialog (IDD_LICENSE, IDD_DIR, IDD_SELCOM, IDD_INST, IDD_INSTFILES, IDD_UNINST or IDD_VERIFY) with a dialog from ui_file.exe+ with the same resource ID. You can also specify 'all' as the dialog if you wish to replace all 7 of the dialogs at once from the same UI file. For some example UIs look at Contrib\UIs under your NSIS directory.
IDD_LICENSEmust containIDC_EDIT1(RICHEDITcontrol).IDD_DIR mustcontainIDC_DIR(edit box),IDC_BROWSE(button) andIDC_CHECK1(checkbox).IDD_SELCOMmust containIDC_TREE1(SysTreeView32 control), andIDC_COMBO1(combo box).IDD_INSTmust containIDC_BACK(button),IDC_CHILDRECT(static control the size of all other dialogs),IDC_VERSTR(static),IDOK(button), andIDCANCEL(button). If an image control (static withSS_BITMAPstyle) will be found in this dialog it will be used as the default forSetBrandingImage.IDD_INSTFILESmust containIDC_LIST1(SysListView32 control),IDC_PROGRESS(msctls_progress32 control), andIDC_SHOWDETAILS(button).IDD_UNINSTmust containIDC_EDIT1(edit box).IDD_VERIFYmust containIDC_STR(static).
ChangeUI all "${NSISDIR}\Contrib\UIs\sdbarker_tiny.exe"
4.8.1.9 CheckBitmap
CheckBitmap bitmap.bmp
Specifies the bitmap with the checkbox images used in the component-selection page treeview.
指定在组件选择页面树视图中使用的复选框图像的位图。
This bitmap should have a size of 96x16 pixels, no more than 8bpp (256 colors) and contain six 16x16 images for the different states (in order: selection mask, not checked, checked, greyed out, unchecked & read-only, checked & read-only). Use magenta as mask color (this area will be transparent).
4.8.1.10 CompletedText
CompletedText text
Replaces the default text ("Completed") that is printed at the end of the install if parameter is specified. Otherwise, the default is used.
如果指定参数,则替换在安装结束时打印出的默认文本(“Completed”)。否则,使用默认值。
Accepts variables. If variables are used, they must be initialized before the message is printed.
接受变量。如果使用变量,则必须在打印消息之前对它们进行初始化。
4.8.1.11 ComponentText
ComponentText [text [subtext] [subtext2]]
Used to change the default text on the component page.
用于更改组件页面上的默认文本。
text: Text above the controls, to the right of the installation icon.
subtext: Text next to the installation type selection.
subtext2: Text to the left of the components list and below the installation type.
The default string will be used if a string is empty ("").
Accepts variables. If variables are used, they must be initialized before the components page is created.
接受变量。如果使用变量,则必须在创建组件页之前对它们进行初始化。
4.8.1.12 CRCCheck
CRCCheck on|off|force
Specifies whether or not the installer will perform a CRC on itself before allowing an install. Note that if the user uses /NCRC on the command line when executing the installer, and you didn't specify 'force', the CRC will not occur, and the user will be allowed to install a (potentially) corrupted installer.
指定安装程序在允许安装之前是否对自身执行CRC。
4.8.1.13 DetailsButtonText
DetailsButtonText show_details_text
Replaces the default details button text of "Show details", if parameter is specified (otherwise the default is used).
如果指定了参数,则替换“Show details”的默认细节按钮文本(否则使用默认)。
Accepts variables. If variables are used, they must be initialized before the install log (instfiles) page is created.
接受变量。如果使用变量,则必须在创建安装日志(instfiles)页面之前对它们进行初始化。
4.8.1.14 DirText
DirText [text] [subtext] [browse_button_text] [browse_dlg_text]
Used to change the default text on the directory page.
用于更改目录页上的默认文本。
text: Text above the controls, to the right of the installation icon.
subtext: Text on the directory selection frame.
browse_button_text: Text on the Browse button.
browse_dlg_text: Text on the "Browse For Folder" dialog, appears after clicking on "Browse" button.
The default string will be used if a string is empty ("").
Accepts variables. If variables are used, they must be initialized before the directory page is created.
接受变量。如果使用变量,则必须在创建目录页之前对它们进行初始化。
4.8.1.15 DirVar
DirVar user_var(dir input/output)
Specifies which variable is to be used to contain the directory selected. This variable should be initialized with a default value. This allows you to easily create two different directory pages that will not require you to move values in and out of $INSTDIR. The default variable is $INSTDIR. This can only be used in PageEx for directory and uninstConfirm pages.
指定要使用哪个变量来包含所选的目录。这个变量应该用一个默认值初始化。这允许您轻松地创建两个不同的目录页面,而不需要在
$INSTDIR中移动值。默认变量是$INSTDIR。这只能在PageEx中用于目录和uninstConfirm页面。
Var ANOTHER_DIR
PageEx directory
DirVar $ANOTHER_DIR
PageExEnd
Section
SetOutPath $INSTDIR
File "a file.dat"
SetOutPath $ANOTHER_DIR
File "another file.dat"
SectionEnd
4.8.1.16 DirVerify
DirVerify auto|leave
If DirVerify leave is used, the Next button will not be disabled if the installation directory is not valid or there is not enough space. A flag that you can read in the leave function using GetInstDirError will be set instead.
如果使用
DirVerify leave,如果安装目录无效或没有足够的空间,Next按钮将不会被禁用。可以使用GetInstDirError在leave-function中读取的标志将被设置。
PageEx directory
DirVerify leave
PageCallbacks "" "" dirLeave
PageExEnd
4.8.1.17 FileErrorText
FileErrorText file_error_text [noignore_file_error_text]
Replaces the default text that comes up when a file cannot be written to. This string can contain a reference to $0, which is the filename ($0 is temporarily changed to this value). Example: "Can not write to file $\r$\n$0$\r$\ngood luck.".
替换无法写入文件时出现的默认文本。
Accepts variables. If variables are used, they must be initialized before File is used.
接受变量。如果使用变量,必须在使用
File之前对它们进行初始化。
4.8.1.18 Icon
Icon [path\]icon.ico
Sets the icon of the installer. Every image in the icon file will be included in the installer. Use UninstallIcon to set the uninstaller icon.
设置安装程序的图标。图标文件中的每个图像都将包含在安装程序中。使用
UninstallIcon设置卸载图标。
4.8.1.19 InstallButtonText
InstallButtonText install_button_text
If parameter is specified, overrides the default install button text (of "Install") with the specified text.
如果指定了参数,则使用指定的文本覆盖默认的安装按钮文本(“install”)。
Accepts variables. If variables are used, they must be initialized before the install button shows.
接受变量。如果使用变量,则必须在安装按钮显示之前对它们进行初始化。
4.8.1.20 InstallColors
InstallColors /windows | (foreground_color background_color)
Sets the colors to use for the install info screen (the default is 00FF00 000000. Use the form RRGGBB (in hexadecimal, as in HTML, only minus the leading '#', since # can be used for comments). Note that if "/windows" is specified as the only parameter, the default windows colors will be used.
设置安装信息屏幕使用的颜色。
4.8.1.21 InstallDir
InstallDir definstdir
Sets the default installation directory. See the variables section for variables that can be used to make this string (especially $PROGRAMFILES). Note that the part of this string following the last \ will be used if the user selects 'browse', and may be appended back on to the string at install time (to disable this, end the directory with a \ (which will require the entire parameter to be enclosed with quotes). If this doesn't make any sense, play around with the browse button a bit.
设置默认安装目录。
4.8.1.22 InstallDirRegKey
InstallDirRegKey root_key subkey key_name
This attribute tells the installer to check a string in the registry and use it as the install dir if that string is valid. If this attribute is present, it will override the InstallDir attribute if the registry key is valid, otherwise it will fall back to the InstallDir value. When querying the registry, this command will automatically remove any quotes. If the string ends in ".exe", it will automatically remove the filename component of the string (i.e. if the string is "C:\Program Files\Foo\app.exe", it will know to use "C:\Program Files\Foo"). For more advanced install directory configuration, set $INSTDIR in .onInit.
此属性告诉安装程序检查注册表中的字符串,如果该字符串有效,则使用该字符串作为安装目录。如果存在此属性,如果注册表项有效,它将覆盖
InstallDir属性,否则它将返回到InstallDir值。
Language strings and variables cannot be used with InstallDirRegKey.
语言字符串和变量不能与
InstallDirRegKey一起使用。
InstallDirRegKey HKLM Software\NSIS ""
InstallDirRegKey HKLM Software\ACME\Thingy InstallLocation
4.8.1.23 InstProgressFlags
InstProgressFlags [flag [...]]
Valid values for flag are "smooth" (smooth the progress bar) or "colored" (color the progress bar with the colors set by InstallColors. Examples: "InstProgressFlags" (default old-school windows look), "InstProgressFlags smooth" (new smooth look), "InstProgressFlags smooth colored" (colored smooth look whee). Note: neither "smooth" or "colored" work with XPStyle on when the installer runs on Windows XP with a modern theme.
flag的有效值是"smooth"(使进度条平滑)或"colored"(用
InstallColors设置的颜色为进度条着色)。
4.8.1.24 InstType
InstType install_type_name [index_output] | /NOCUSTOM | /CUSTOMSTRING=str | /COMPONENTSONLYONCUSTOM
Adds an install type to the install type list, or disables the custom install type. There can be as many as 32 types, each one specifying the name of the install type. If the name is prefixed with 'un.' it is an uninstaller install type. The name can contain variables which will be processed at runtime before the components page shows. Another way of changing the InstType name during runtime is the InstTypeSetText command. The difference is that with InstTypeSetText you are saving your precious user variables. The first type is the default (generally 'Typical' or 'Full'). If the /NOCUSTOM switch is specified, then the "custom" install type is disabled, and the user has to choose one of the pre-defined install types. Alternatively, if the /CUSTOMSTRING switch is specified, the parameter will override the "Custom" install type text. Alternatively, if the /COMPONENTSONLYONCUSTOM flag is specified, the component list will only be shown if the "Custom" install type is selected.
将安装类型添加到安装类型列表中,或禁用自定义安装类型。
Accepts variables for type names. If variables are used, they must be initialized before the components page is created.
接受类型名称的变量。如果使用变量,则必须在创建组件页之前对它们进行初始化。
SectionInstType is used to bind Sections to install types.
SectionInstType用于将Sections绑定到安装类型。
4.8.1.25 LicenseBkColor
LicenseBkColor color | /gray | /windows
Sets the background color of the license data. Color is specified using the form RRGGBB (in hexadecimal, as in HTML, only minus the leading '#', since # can be used for comments). Default is '/gray'. You can also use the Windows OS defined color by using '/windows'.
设置license数据的背景颜色。
4.8.1.26 LicenseData
LicenseData licdata.(txt|rtf)
Specifies a text file or a RTF file to use for the license that the user can read. Omit this to not have a license displayed. Note that the file must be in DOS text format (\r\n). To define a multilingual license data use LicenseLangString.
指定一个文本文件或RTF文件用于用户可以读取的许可证。
If you are using a RTF file it is recommended that you edit it with WordPad and not MS Word. Using WordPad will result in a much smaller file.
Use LicenseLangString to show a different license for every language.
使用
LicenseLangString来显示每种语言的不同许可。
4.8.1.27 LicenseForceSelection
LicenseForceSelection (checkbox [accept_text] | radiobuttons [accept_text] [decline_text] | off)
Specifies if the displayed license must be explicitly accepted or not. This can be done either by a checkbox or by radiobuttons. By default the "next button" is disabled and will only be enabled if the checkbox is enabled or the correct radio button is selected. If off is specified the "next button" is enabled by default.
指定是否必须显式接受显示的许可证。
LicenseForceSelection checkbox
LicenseForceSelection checkbox "i accept"
LicenseForceSelection radiobuttons
LicenseForceSelection radiobuttons "i accept"
LicenseForceSelection radiobuttons "i accept" "i decline"
LicenseForceSelection radiobuttons "" "i decline"
LicenseForceSelection off
4.8.1.28 LicenseText
LicenseText [text [button_text]]
Used to change the default text on the license page.
用于修改license页面的默认文本。
text: Text above the controls, to the right of the installation icon.
button_text: Text on the "I Agree" button.
The default string will be used if a string is empty ("").
Accepts variables. If variables are used, they must be initialized before the license page is created.
接受变量。如果使用变量,则必须在创建许可页面之前对它们进行初始化。
4.8.1.29 ManifestDPIAware
ManifestDPIAware notset|true|false
Declare that the installer is DPI-aware. A DPI-aware application is not scaled by the DWM (DPI virtualization) so the text is never blurry. NSIS does not scale the bitmap used by the tree control on the component page and some plugins might have compatibility issues so make sure that you test your installer at different DPI settings if you select true.
声明安装程序是支持dpi的。
See MSDN for more information about DPI-aware applications.
4.8.1.30 ManifestLongPathAware
ManifestLongPathAware notset|true|false
Declare that the installer can handle paths longer than MAX_PATH. Only supported on Windows 10 Anniversary Update and later.
声明安装程序可以处理大于MAX_PATH的路径。
Note: Instructions like CopyFiles and CreateShortcut do not support long paths!
Note: Has no effect if the "Enable Win32 long paths" policy is not enabled.
4.8.1.31 ManifestSupportedOS
ManifestSupportedOS none|all|WinVista|Win7|Win8|Win8.1|Win10|{GUID} [...]
Declare that the installer is compatible with the specified Windows version(s). This adds a SupportedOS entry in the compatibility section of the application manifest. The default is Win7+8+8.1+10. none is the default if RequestExecutionLevel is set to none for compatibility reasons.
声明安装程序与指定的Windows版本兼容。
Windows 8.1 and later will fake its version number if you don't declare support for that particular version. You can read more about the other changes in behavior on MSDN.
4.8.1.32 MiscButtonText
MiscButtonText [back_button_text [next_button_text] [cancel_button_text] [close_button_text]]
Replaces the default text strings for the four buttons (< Back, Next >, Cancel and Close). If parameters are omitted, the defaults are used.
替换四个按钮的默认文本字符串。如果省略参数,则使用默认值。
Accepts variables. If variables are used, they must be initialized in .onInit.
接受变量。如果使用了变量,则必须在
.oninit中初始化它们。
4.8.1.33 Name
Name name [name_doubled_ampersands]
Sets the name of the installer. The name is usually simply the product name such as 'MyApp' or 'CrapSoft MyApp'. If you have one or more ampersands (&) in the name, set the second parameter to the same name, only with doubled ampersands. For example, if your product's name is "Foo & Bar", use:
设置安装程序的名称。
Name "Foo & Bar" "Foo && Bar"
If you have ampersands in the name and use a LangString for the name, you will have to create another one with doubled ampersands to use as the second parameter.
Accepts variables. If variables are used, they must be initialized in .onInit.
接受变量。如果使用了变量,则必须在
.oninit中初始化它们。
4.8.1.34 OutFile
OutFile [path\]install.exe
Specifies the output file that the MakeNSIS should write the installer to. This is just the file that MakeNSIS writes, it doesn't affect the contents of the installer.
指定MakeNSIS应将安装程序写入的输出文件。这只是MakeNSIS写的文件,它不会影响安装程序的内容。
4.8.1.35 PEAddResource
PEAddResource [/OVERWRITE|/REPLACE] file restype resname [reslang]
Adds file as a resource to the installer and uninstaller. restype specifies the resource type and can be any string or # followed by a standard type or number. resname must be # followed by a number. reslang is optional and specifies the language id of the resource. Replacing standard NSIS resources is not supported, you should use Icon and ChangeUI instead.
将文件作为资源添加到安装程序和卸载程序。
PEAddResource "myimage.bmp" "#2" "#1337"
PEAddResource "mybonus.ico" "#Icon" "#200"
PEAddResource "myimage.png" "PNG" "#1234"
PEAddResource "res://$%WINDIR%/Explorer.exe/#Icon/#101" "#Icon" "#1337"
4.8.1.36 PERemoveResource
PERemoveResource [/NOERRORS] restype resname reslang|ALL
Removes a resource added with PEAddResource.
删除用
PEAddResource添加的资源。
PERemoveResource "#Icon" "#200" ALL
4.8.1.37 RequestExecutionLevel
RequestExecutionLevel none|user|highest|admin
Specifies the requested execution level for Windows Vista and higher. The value is embedded in the installer and uninstaller's XML manifest and tells Windows which privilege level the installer requires. user requests the user's normal level with no administrative privileges. highest will request the highest execution level available for the current user and will cause Windows to prompt the user to verify privilege escalation if they are a member of the administrators group. The prompt might request for the user's password. admin, which is also the default, requests administrator level and will cause Windows to prompt the user as well. Specifying none will keep the manifest empty and let Windows decide which execution level is required. Windows automatically identifies NSIS installers and decides administrator privileges are required. Because of this, none and admin have virtually the same effect.
指定Windows Vista及更高版本的请求执行级别。
It's recommended that every application is marked with a required execution level. Unmarked installers are subject to compatibility mode. Workarounds of this mode include automatically moving any shortcuts created in the user's start menu to all users' start menu. Installers that don't install anything into system folders nor write to the local machine registry (HKLM) should specify user execution level.
More information about this topic can be found on MSDN.
4.8.1.38 SetFont
SetFont [/LANG=lang_id] font_face_name font_size
Sets the installer font. Please remember that the font you choose must be present on the user's machine as well. Don't use rare fonts that only you have.
设置安装程序字体。
Use the /LANG switch if you wish to set a different font for each language. For example:
SetFont /LANG=${LANG_ENGLISH} "English Font" 9
SetFont /LANG=${LANG_FRENCH} "French Font" 10
There are two LangStrings named ^Font and ^FontSize which contain the font and font size for every language.
4.8.1.39 ShowInstDetails
ShowInstDetails hide|show|nevershow
Sets whether or not the details of the install are shown. Can be 'hide' to hide the details by default, allowing the user to view them, or 'show' to show them by default, or 'nevershow', to prevent the user from ever seeing them. Note that sections can override this using SetDetailsView.
设置是否显示安装的详细信息。
4.8.1.40 ShowUninstDetails
ShowUninstDetails hide|show|nevershow
Sets whether or not the details of the uninstall are shown. Can be 'hide' to hide the details by default, allowing the user to view them, or 'show' to show them by default, or 'nevershow', to prevent the user from ever seeing them. Note that sections can override this using SetDetailsView.
设置是否显示卸载的详细信息。
4.8.1.41 SilentInstall
SilentInstall normal|silent|silentlog
Specifies whether or not the installer should be silent. If it is 'silent' or 'silentlog', all sections that have the SF_SELECTED flag are installed quietly (you can set this flag using SectionSetFlags), with no screen output from the installer itself (the script can still display whatever it wants, use MessageBox's /SD to specify a default for silent installers). Note that if this is set to 'normal' and the user runs the installer with /S (case sensitive) on the command line, it will behave as if SilentInstall 'silent' was used. Note: see also LogSet.
指定安装程序是否应该是静默的。
See section 4.12 for more information.
4.8.1.42 SilentUnInstall
SilentUnInstall normal|silent
Specifies whether or not the uninstaller should be silent. If it is 'silent' the uninstall sections will run quietly, with no screen output from the uninstaller itself (the script can still display whatever it wants, use MessageBox's /SD to specify a default for silent uninstallers). Note that if this is set to 'normal' and the user runs the uninstaller with /S on the command line, it will behave as if SilentUnInstall 'silent' was used.
指定卸载程序是否应该是静默的。
See section 4.12 for more information.
4.8.1.43 SpaceTexts
SpaceTexts [req_text [avail_text]]
If parameters are specified, overrides the space required and space available text ("Space required: " and "Space available: " by default). If 'none' is specified as the required text no space texts will be shown.
如果指定了参数,则覆盖所需的空间和可用的空间文本。
Accepts variables. If variables are used, they must be initialized before the components page is created.
接受变量。如果使用变量,则必须在创建组件页之前对它们进行初始化。
4.8.1.44 SubCaption
SubCaption [page_number subcaption]
Overrides the subcaptions for each of the installer pages (0=": License Agreement",1=": Installation Options",2=": Installation Directory", 3=": Installing Files", 4=": Completed"). If you specify an empty string (""), the default will be used (you can however specify " " to achieve a blank string).
覆盖每个安装程序页面的子标题。
You can also set a subcaption (or override the default) using Caption inside a PageEx block.
Accepts variables. If variables are used, they must be initialized before the relevant page is created.
接受变量。如果使用变量,则必须在创建相关页面之前对它们进行初始化。
4.8.1.45 UninstallButtonText
UninstallButtonText text
Changes the text of the button that by default says "Uninstall" in the uninstaller. If no parameter is specified, the default text is used.
更改在卸载程序中默认表示“Uninstall”的按钮的文本。如果没有指定参数,则使用默认文本。
Accepts variables. If variables are used, they must be initialized before the uninstall button shows.
接受变量。如果使用了变量,必须在卸载按钮显示之前对它们进行初始化。
4.8.1.46 UninstallCaption
UninstallCaption caption
Sets what the titlebars of the uninstaller will display. By default it is '$(^Name) Uninstall', where Name is specified with the Name command. You can, however, override it with 'MyApp uninstaller' or whatever. If you specify an empty string (""), the default will be used (you can specify " " to simulate a empty string).
设置卸载程序的标题栏显示的内容。
Accepts variables. If variables are used, they must be initialized in un.onInit.
接受变量。如果使用了变量,则必须在
un.onInit中初始化它们。
4.8.1.47 UninstallIcon
UninstallIcon [path\]icon.ico
Sets the icon of the uninstaller.
设置卸载程序的图标。
4.8.1.48 UninstallSubCaption
UninstallSubCaption page_number subcaption
Sets the default subcaptions for the uninstaller pages (0=": Confirmation",1=": Uninstalling Files",2=": Completed"). If you specify an empty string (""), the default will be used (you can specify " " to simulate a empty string).
设置卸载程序页面的默认子标题。
You can also set a subcaption (or override the default) using Caption inside a PageEx block.
Accepts variables. If variables are used, they must be initialized before the relevant page is created.
接受变量。如果使用变量,则必须在创建相关页面之前对它们进行初始化。
4.8.1.49 UninstallText
UninstallText text [subtext]
Specifies the texts on the uninstaller confirm page.
指定卸载程序确认页上的文本。
text: Text above the controls
subtext: Text next to the uninstall location
Accepts variables. If variables are used, they must be initialized before the uninstaller confirm page is created.
接受变量。如果使用了变量,则必须在创建卸载确认页面之前对它们进行初始化。
4.8.1.50 WindowIcon
WindowIcon on|off
Sets whether or not the installer's icon is displayed on certain pages.
设置是否在某些页面上显示安装程序的图标。
4.8.1.51 XPStyle
XPStyle on|off
Sets whether or not a XP visual style manifest will be added to the installer. This manifest makes the installers controls use the new visual styles when running on Windows XP and later. This affects the uninstaller too.
设置是否将XP可视化样式清单添加到安装程序中。
4.8.2 Compiler Flags
The following commands affect how the compiler generates code and compresses data. Unless otherwise noted, these commands are valid anywhere in the script and affect every line below where each one is placed (until overridden by another command). They cannot be jumped over using flow control instructions.
以下命令影响编译器生成代码和压缩数据的方式。除非另有说明,否则这些命令在脚本中的任何地方都是有效的,并且会影响下面的每一行(直到被另一个命令覆盖)。不能使用流控制指令跳过它们。
For example, in the following script, blah.dat will never be overwritten.
${If} $0 == 0
SetOverwrite on
${Else}
SetOverwrite off
${EndIf}
File blah.dat # overwrite is always off here!
Instead, the following should be used.
${If} $0 == 0
SetOverwrite on
File blah.dat
${Else}
SetOverwrite off
File blah.dat
${EndIf}
4.8.2.1 AllowSkipFiles
AllowSkipFiles on|off
This command specifies whether the user should be able to skip a file or not. A user has an option to skip a file if SetOverwrite is set to on (default) and the installer fails to open a file for writing when trying to extract a file. If off is used the ignore button which allows the user to skip the file will not be shown and the user will only have an option to abort the installation (Cancel button) or retry opening the file for writing (Retry button). If on is used the user will have an option to skip the file (error flag will be set - see SetOverwrite).
这个命令指定用户是否应该能够跳过一个文件。
4.8.2.2 FileBufSize
FileBufSize buffer_size_in_mb
This command sets the size of the compiler's internal file buffers. This command allows you to control the compiler's memory usage by limiting how much of a given file it will load into memory at once. Since the compiler needs both input and output, twice the memory size specified could be used at any given time for file buffers. This command does not limit the compression buffers which could take another couple of MB, neither does it limit the compiler's other internal buffers, but those shouldn't normally top 1MB anyway. Specifying a very small number could decrease performance. Specifying a very large number could exhaust system resources and force the compiler to cancel the compilation process. The default value is 32MB.
这个命令设置编译器的内部文件缓冲区的大小。
4.8.2.3 SetCompress
SetCompress auto|force|off
This command sets the compress flag which is used by the installer to determine whether or not data should be compressed. Typically the SetCompress flag will affect the commands after it, and the last SetCompress command in the file also determines whether or not the install info section and uninstall data of the installer is compressed. If compressflag is 'auto', then files are compressed if the compressed size is smaller than the uncompressed size. If compressflag is set to 'force', then the compressed version is always used. If compressflag is 'off' then compression is not used (which can be faster).
这个命令设置压缩标志,安装程序使用它来确定是否应该压缩数据。
Note that this option has no effect when solid compression is used.
4.8.2.4 SetCompressor
SetCompressor [/SOLID] [/FINAL] zlib|bzip2|lzma
This command sets the compression algorithm used to compress files/data in the installer. It can only be used outside of sections and functions and before any data is compressed. Different compression methods can not be used for different files in the same installer. It is recommended to use it at the very top of the script to avoid compilation errors.
这个命令设置用于在安装程序中压缩文件/数据的压缩算法。它只能在区段和函数之外使用,并且在任何数据被压缩之前。不同的压缩方法不能用于同一安装程序中的不同文件。建议在脚本的顶部使用它,以避免编译错误。
Three compression methods are supported: ZLIB, BZIP2 and LZMA.
- ZLIB (the default) uses the deflate algorithm, it is a quick and simple method. With the default compression level it uses about 300 KB of memory.
- BZIP2 usually gives better compression ratios than ZLIB, but it is a bit slower and uses more memory. With the default compression level it uses about 4 MB of memory.
- LZMA is a new compression method that gives very good compression ratios. The decompression speed is high (10-20 MB/s on a 2 GHz CPU), the compression speed is lower. The memory size that will be used for decompression is the dictionary size plus a few KBs, the default is 8 MB.
If /FINAL is used, subsequent calls to SetCompressor will be ignored.
If /SOLID is used, all of the installer data is compressed in one block. This results in greater compression ratios.
4.8.2.5 SetCompressorDictSize
SetCompressorDictSize dict_size_mb
Sets the dictionary size in megabytes (MB) used by the LZMA compressor (default is 8 MB).
4.8.2.6 SetDatablockOptimize
SetDatablockOptimize on|off
This command tells the compiler whether or not to do datablock optimizations. Datablock optimizations causes the compiler to check to see if any data being added to the data block is already in the data block, and if so, it is simply referenced as opposed to added (can save a little bit of size). It is highly recommended to leave this option on.
这个命令告诉编译器是否要进行数据锁优化。
4.8.2.7 SetDateSave
SetDateSave on|off
This command sets the file date/time saving flag which is used by the File command to determine whether or not to save the last write date and time of the file, so that it can be restored on installation. Valid flags are 'on' and 'off'. 'on' is the default.
该命令设置文件日期/时间节省标志,file命令使用该标志来决定是否保存文件的最后写入日期和时间,以便在安装时可以恢复它。
4.8.2.8 SetOverwrite
SetOverwrite on|off|try|ifnewer|ifdiff|lastused
This command sets the overwrite flag which is used by the File command to determine whether or not the file should overwrite any existing files that are present. If overwriteflag is 'on', files are overwritten (this is the default). If overwriteflag is 'off', files that are already present are not overwritten. If overwriteflag is 'try', files are overwritten if possible (meaning that if the file is not able to be written to, it is skipped without any user interaction). If overwriteflag is 'ifnewer', then files are only overwritten if the existing file is older than the new file. If overwriteflag is 'ifdiff', then files are only overwritten if the existing file is older or newer than the new file. Note that when in 'ifnewer' or 'ifdiff' mode, the destination file's date is set, regardless of what SetDateSave is set to.
这个命令设置覆盖标志,
File命令使用该标志来确定文件是否应该覆盖现有的任何文件。
SetOverwrite off
File program.cfg # config file we don't want to overwrite
SetOverwrite on
4.8.2.9 Unicode
Unicode true|false
Generate a Unicode installer. It can only be used outside of sections and functions and before any data is compressed.
生成Unicode安装程序。它只能在区段和函数之外使用,并且在任何数据被压缩之前。
4.8.3 Version Information
4.8.3.1 VIAddVersionKey
VIAddVersionKey [/LANG=lang_id] keyname value
Adds a string entry to the version information stored in the installer and uninstaller. These can be viewed in the File Properties Version or Details tab. keyname can either be a special name known by Windows or a user defined name. /LANG=0 can be used to indicate a language neutral language id. The following names are known by Windows:
将字符串项添加到存储在安装程序和卸载程序中的版本信息中。
- ProductName
- Comments
- CompanyName
- LegalCopyright
- FileDescription
- FileVersion
- ProductVersion
- InternalName
- LegalTrademarks
- OriginalFilename
- PrivateBuild
- SpecialBuild
The displayed name of these special entries are translated on the target system, whereas user defined keynames remain untranslated.
VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "Test Application"
VIAddVersionKey /LANG=${LANG_ENGLISH} "Comments" "A test comment"
VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "Fake company"
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalTrademarks" "Test Application is a trademark of Fake company"
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "© Fake company"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "Test Application"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "1.2.3"
4.8.3.2 VIProductVersion
VIProductVersion version_string_X.X.X.X
Sets the Product Version in the VS_FIXEDFILEINFO version information block.
在
VS_FIXEDFILEINFO版本信息块中设置Product Version。
VIProductVersion 1.2.3.4
4.8.3.3 VIFileVersion
VIFileVersion version_string_X.X.X.X
Sets the File Version in the VS_FIXEDFILEINFO version information block (You should also set the FileVersion string with VIAddVersionKey so the information is displayed at the top of the Version Tab in the Properties of the file). If you don't provide a File Version the Product Version is used in the VS_FIXEDFILEINFO block.
VIFileVersion 1.2.3.4