启用和停用延迟扩展,它有什么作用? [英] Enable and Disable Delayed Expansion, what does it do?
问题描述
我见过 SETLOCAL ENABLEDELAYEDEXPANSION
&安培; SETLOCAL DISABLEDELAYEDEXPANSION
在许多批处理文件,但什么命令实际上做?
I've seen SETLOCAL ENABLEDELAYEDEXPANSION
& SETLOCAL DISABLEDELAYEDEXPANSION
in many batch files but what do the commands actually do?
推荐答案
enabledelayeexpansion
指示 CMD
来识别语法!无功!
,用于访问 VAR
的电流
值。 disabledelayedexpansion
打开这个设施关闭,所以!无功!
变得简单,作为一个文字字符串。
enabledelayeexpansion
instructs cmd
to recognise the syntax !var!
which accesses the current
value of var
. disabledelayedexpansion
turns this facility off, so !var!
becomes simply that as a literal string.
在一个块语句(一parenthesised一系列语句)
,在全部块被解析和然后执行。任何%VAR%
块内将在块被解析的时间变量的值的替换 - 程序被执行前 - 同样的道理也适用于一个 FOR ... DO(块)
。
Within a block statement (a parenthesised series of statements)
, the entire block is parsed and then executed. Any %var%
within the block will be replaced by that variable's value at the time the block is parsed - before the block is executed - the same thing applies to a FOR ... DO (block)
.
在使用
访问!无功!
%VAR%的更改值VAR
。
这篇关于启用和停用延迟扩展,它有什么作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!