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

查看:139
本文介绍了如何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 如果它被设置在脚本的第一线,而不是禁止,直到脚本结束对脚本产生不利影响?

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 是传递给一个paramater SETLOCAL 命令(看看 SETLOCAL /?

ENABLEDELAYEDEXPANSION is a paramater passed to the SETLOCAL command (look at setlocal /?)

它的作用和生命为脚本的持续时间,或 ENDLOCAL

Its effect lives for the duration of the script, or an ENDLOCAL:

当达到一个批处理脚本结束时,一个隐含 ENDLOCAL
  通过该批次发出任何未决 SETLOCAL 执行命令
  脚本。

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天全站免登陆