在 cmd 提示符中使用“setlocalenabledelayedexpansion”

use*_*964 6 cmd batch-file

setlocal enabledelayedexpansion只能在批处理文件中工作吗?如何setlocal enabledelayedexpansion在cmd提示符下使用?

Som*_*ark 4

您可以使用以下命令在命令提示符中启用延迟扩展cmd /V:ON

cmd /?

/V:ON   Enable delayed environment variable expansion using ! as the
        delimiter. For example, /V:ON would allow !var! to expand the
        variable var at execution time.  The var syntax expands variables
        at input time, which is quite a different thing when inside of a FOR
        loop.
Run Code Online (Sandbox Code Playgroud)