环境表Environment Table

环境表用于设置环境变量的值。The Environment table is used to set the values of environment variables.

环境表包含以下列。The Environment table has the following columns.

Column 类型Type Key NullableNullable
环境Environment 标识符Identifier YY NN
名称Name 文本Text NN NN
Value Formatted NN YY
组件_Component_ 标识符Identifier NN NN

Columns

环境Environment

这是表的主键,是非本地化标记。This is the primary key of the table and is a non-localized token.

路径名Name

此列是环境变量的可本地化的名称。This column is the localizable name of the environment variable. 根据下表中的哪些字符为名称加上前缀来写入或移除键值。The key values are written or removed depending upon which of the characters in the following table are prefixed to the name. 在前缀中使用的符号顺序不起作用。There is no effect in the ordering of the symbols used in a prefix.

前缀Prefix 说明Description
= 如果该环境变量不存在,则创建它,然后在安装过程中对其进行设置。Create the environment variable if it does not exist, and then set it during installation. 如果环境变量存在,请在安装过程中进行设置。If the environment variable exists, set it during the installation.
+ 如果该环境变量不存在,则创建它,然后在安装过程中对其进行设置。Create the environment variable if it does not exist, then set it during installation. 如果环境变量的值已存在,则不会产生任何影响。This has no effect on the value of the environment variable if it already exists.
- 删除组件时删除环境变量。Remove the environment variable when the component is removed. 此符号可以与任何前缀组合在一起。This symbol can be combined with any prefix.
!! 在安装过程中删除环境变量。Remove the environment variable during an installation. 如果该变量的名称和值与环境表的 "名称" 和 "值" 字段中的条目匹配,则安装程序将在安装过程中仅删除环境变量。The installer only removes an environment variable during an installation if the name and value of the variable match the entries in the Name and Value fields of the Environment table. 如果要删除某个环境变量,而不考虑其值,请使用 "!" 语法,并将值字段保留为空。If you want to remove an environment variable, regardless of its value, use the '!' syntax, and leave the Value field empty.
* 此前缀与 Windows 2000 一起使用,以指示该名称引用系统环境变量。This prefix is used with Windows 2000 to indicate that the name refers to a system environment variable. 如果不存在星号,则安装程序会将该变量写入用户的环境中。If no asterisk is present, the installer writes the variable to the user's environment. 此符号可以与任何前缀组合在一起。This symbol can be combined with any prefix. 在每计算机 安装上下文 中用于安装的包应通过 * 在 "名称" 列中包含来将环境变量写入计算机的环境。A package that is used for installation in the per-machine installation context should write environment variables to the machine's environment by including * in the Name column. 有关详细信息,请参阅“备注”。For more information, see Remarks.
=- 环境变量是在安装时设置的,并在卸载时删除。The environment variable is set on install and removed on uninstall. 这是通常的行为。This is the usual behavior.
!-!- 在安装或卸载期间删除环境变量。Removes an environment variable during an install or uninstall.
=+ !+=+ !+
!=!=
这不是有效的前缀These are not a valid prefixes

如果表中的值字段包含 [ ~ ] ,则前缀字符仅适用于字符串的指定部分。If the Value field in the table includes a [~], then the prefix characters apply to only the specified portion of the string. 下面的 " [ ~ ] 值列" 部分介绍了的用法。The use of [~] is described below in the Value column section.

如果表的值字段为空,则删除环境变量。The environment variable is removed if the Value field of the table is blank. 因此,在 "值" 字段中为空,"=" 前缀将删除安装中的环境变量,并在卸载时删除所有当前值。Therefore, with a blank in the Value field, an = prefix deletes the environment variable on install and a - prefix deletes any current values on uninstall.

负值Value

此列包含要设置为带格式字符串的可本地化值。This column contains the localizable value that is to be set as a formatted string. 请参阅 格式化See Formatted. 如果将此字段留空,则将删除该变量。If this field is left blank, the variable is removed. 如果该字段为空,并且名称字段中的字符串带有符号前缀,则仅在删除该组件时才会删除该变量。If the field is blank and the string in the Name field is prefixed by the - symbol, the variable is removed only when the component is removed.

若要将某个值追加到现有变量的末尾,请在此字段中为该字符串加上空字符 [ ~ ] 和分隔符。To append a value to the end of an existing variable, prefix the string in this field by the Null character [~] and the separator character. 例如,如果分号是所选分隔符: [ ~ ] ;For example, if the semicolon is the chosen separator: [~];Value.

若要为现有变量的前面添加值前缀,请在此字段中追加分隔符和空字符的字符串 [ ~ ] 。To prefix a value to the front of an existing variable, append the string in this field by the separator character and the Null character [~]. 例如,如果分号是所选分隔符:; [ ~ ].For example, if the semicolon is the chosen separator: Value;[~] .

如果 [ ~ ] 字段中不存在,则该字符串表示要设置或删除的整个值。If no [~] is present in the field, the string represents the entire value to be set or deleted.

每行只能包含一个值。Each row can contain only one value. 例如,输入 ; [ ~ ; ]为多个值,不应使用,因为它会导致不可预知的结果。For example, the entry Value;Value;[~] is more than one value and should not be used because it causes unpredictable results. 条目 ; [ ~ ]只是一个值。The entry Value;[~] is just one value.

如果名称以 + 为前缀,则 [ ~ ] 不得在 "值" 列中使用。If Name is prefixed with +, then [~] must not be used in Value column. 这是因为 "+" 和 "" 的含义彼此之间 [ ~ ] 是明确的。This is because the meaning of "+" and "[~]" are clearly exclusive of one another.

组件_Component_

组件表的第一列的外部键。An external key to the first column of the Component table. 此列引用控制环境值的安装的组件。This column references the component that controls the installation of the environment values.

备注Remarks

为了使安装程序能够设置环境变量, WriteEnvironmentStrings 操作RemoveEnvironmentStrings 操作 需要在 InstallExecuteSequence 表中列出。For the installer to set environment variables, the WriteEnvironmentStrings action and RemoveEnvironmentStrings action need to be listed in the InstallExecuteSequence Table.

请注意,当运行 WriteEnvironmentStrings 操作RemoveEnvironmentStrings 操作 时,环境变量不会更改正在进行的安装。Note that environment variables do not change for the installation in progress when either the WriteEnvironmentStrings action or RemoveEnvironmentStrings action are run. 在 Windows 2000 上,此信息存储在注册表中,并且当安装完成时,会有一条消息通知系统发生了更改。On Windows 2000, this information is stored in the registry and a message notifies the system of changes when the installation completes. 新进程或另一个检查这些消息的进程使用新的环境变量。A new process, or another process that checks for these messages, uses the new environment variables.

当修改带有环境表的 path 环境变量时,不要尝试将整个新路径显式输入到 "值" 字段中。When modifying the path environment variable with the Environment table, do not attempt to enter the entire new path explicitly into the Value field. 相反,可以通过在 ( 的情况下 ) 或追加值和分隔符来扩展现有路径 [ ~ ] 。Instead, extend the existing path by prefixing or appending a value and delimiter (;) to [~]. 如果 [ ~ ] 值字段中不存在,则会丢失现有的路径信息,并且安装 .msi 文件可能会阻止计算机启动。If [~] is not present in the Value field, the existing path information is lost and installing the .msi file may prevent the computer from booting. Path 变量通常使用语法: [ ~ ] ;负值.The path variable is mostly commonly set using the syntax: [~];Value.

从终端服务器执行基于计算机的安装时,安装程序会将每用户环境变量写入 hku 开头 \ 。默认 \ 环境When performing per-machine installations from a terminal server, the installer writes per-user environment variables to HKU\.Default\Environment. 由于终端服务不会复制此部分注册表,因此安装不会设置每用户环境变量。Because Terminal Services does not replicate this section of the registry, the installation does not set the per-user environment variables. 用于每计算机安装的包应通过 * 在 "名称" 列中包含来将环境变量写入计算机的环境。A package used for per-machine installations should write environment variables to the computer's environment by including * in the Name column. 如果包可以按用户或每台计算机安装,请创建两个组件: (1) 每个用户的组件,其中包含为用户设置创作的环境表项, (2) 每台计算机组件,其中包含为计算机设置创作的环境表。If the package can be installed per-user or per-machine, create two components: (1) a per-user component with the Environment table entries authored for user settings, and (2) a per-machine component with the Environment table authored for computer settings. 使用 特权 属性安装此组件的条件。Condition the installation of this component using the Privileged property.

验证Validation

ICE03ICE03
ICE06ICE06
ICE32ICE32
ICE46ICE46
ICE65ICE65
ICE69ICE69
ICE80ICE80