如何SETLOCAL和ENABLEDELAYEDEXPANSION工作? [英] How do SETLOCAL and ENABLEDELAYEDEXPANSION work?

查看:372
本文介绍了如何SETLOCAL和ENABLEDELAYEDEXPANSION工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到在大多数脚本中,两个通常在同一行如此:

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 outstanding SETLOCAL commands issued by that batch script.

这篇关于如何SETLOCAL和ENABLEDELAYEDEXPANSION工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆