如何SETLOCAL和ENABLEDELAYEDEXPANSION工作? [英] How do SETLOCAL and ENABLEDELAYEDEXPANSION work?
问题描述
我注意到在大多数脚本中,两个通常在同一行如此:
I notice in most scripts, the two are usually in the same line as so:
SETLOCAL ENABLEDELAYEDEXPANSION
这两个实际上是单独的命令,可以写在单独的行上吗?
Are the two in fact separate commands and can be written on separate lines?
如果将脚本的第一行设置为 ENABLEDELAYEDEXPANSION
,则会对脚本产生负面影响,并且在脚本结束之前未禁用脚本? / p>
Will setting ENABLEDELAYEDEXPANSION
have an adverse effect on a script if it is set on the first lines of the script and not disabled until the end of the script?
推荐答案
ENABLEDELAYEDEXPANSION
是传递给 SETLOCAL
命令(查看 setlocal /?
)
ENABLEDELAYEDEXPANSION
is a parameter passed to the SETLOCAL
command (look at setlocal /?
)
或 ENDLOCAL
:
批处理脚本结束时,对该批处理发出的任何未处理的
SETLOCAL
命令执行的
暗示ENDLOCAL
脚本。
When the end of a batch script is reached, an implied
ENDLOCAL
is executed for any outstandingSETLOCAL
commands issued by that batch script.
这篇关于如何SETLOCAL和ENABLEDELAYEDEXPANSION工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!