http://technet.microsoft.com/en-us/library/bb490954.aspx ---微软官方网站
关于环境变量这段话的翻译,
Substituting environment variable values
取代环境变量的值
To enable the substitution of variable values at the command line or in scripts,
在命令行或脚本中是能够取代环境变量的值的
enclose the variable name in percent signs (that is, %variablename%).
用百分号包围变量名(如:%variablename%)
By using percent signs,
靠使用百分号
you ensure that Cmd.exe references the variable values instead of making a literal
comparison.
你保证可以使用cmd.exe参考变量的值,以取代创建的文字比较。
After you define variable values for a variable name,
在你为变量名定义了变量的值之后,
enclose the variable name in percent signs.
在百分号包围了变量名之后。
Cmd.exe searches for all instances of the variable name and replaces it with the defined variable value.
cmd会搜查所有变量名的实例,并且用定义的值取代它。
For example, if you create a script that contains different values (for example, user names)
and you want to define the USERNAME environment variable for each user with these values,
例如:如果你创建了一个脚本,它包含了不同的值(比如,若干用户名),并且你要定义用户名环境变量,
为每一个要使用这些值的用户,
you can write one script using the variable USERNAME enclosed in percent signs.
你能够使用被百分号包围的变量名写一个脚本。
When you run this script,
当你运行这个脚本时,
Cmd.exe replaces %USERNAME% with the variable values,
cmd就用变量的值取代%USERNAME% ,
which eliminates the need to perform this task manually for each user. Variable substitution is not recursive.
它排除了每个用户手工去完成这个任务,变量的取代不是递归的。
Cmd.exe checks variables once. For more information about variable substitution, see For and Call
cmd立即检查全部变量。需要更多的关于变量取代的信息,看for和call
Note
注释
The maximum individual environment variable size is 8192bytes.
最大的当环境变量的大小是8192b
The maximum total environment variable size for all variables, which includes variable names and the equal sign, is 65,536KB.
最大的全部环境变量的大小是,包括名字,等号,为65536kb
我实验过,环境变量值的最大长度只能为8185,还有7过字节是保留字节,无法使用。
Last edited by 5yue5 on 2009-3-1 at 04:13 ]