问题描述
注:
这是不是重复!作者暂时中断SETLOCAL
NOTE:
THIS IS NOT A DUPLICATE!! OF "Temporarily interrupt SETLOCAL"
我想能够 SETLOCAL ENABLEDELAYEDEXPANSION
然后做一些事情,那么 ENDLOCAL ENABLEDELAYEDEXPANSION
做别的事情(7Z命令),那么 SETLOCAL ENABLEDELAYEDEXPANSION
再次在蝙蝠!因为7z.exe不允许 SETLOCAL ENABLEDELAYEDEXPANSION
。看到了吗?
i want to be able to SETLOCAL ENABLEDELAYEDEXPANSION
then do something, then ENDLOCAL ENABLEDELAYEDEXPANSION
do something else (7z command) then SETLOCAL ENABLEDELAYEDEXPANSION
once again in a .bat! because 7z.exe does not allow SETLOCAL ENABLEDELAYEDEXPANSION
. see?
code:
SETLOCAL ENABLEDELAYEDEXPANSION
Echo hi!
7z e -o"C:\test" -i!*.jar "C:\*.zip"
输出:结果
您好!
结果
错误:不正确的命令行
当我改变我的code为:
when i change my code to:
Echo hi!
7z e -o"C:\test" -i!*.jar "C:\*.zip"
它的工作原理!!!!!!
it works!!!!!!
这是我的code到目前为止中断 SETLOCAL ENABLEDELAYEDEXPANSION
,遗憾的是它不工作。
here is my code so far to interrupt SETLOCAL ENABLEDELAYEDEXPANSION
, unfortunately it doesn't work.
SETLOCAL ENABLEDELAYEDEXPANSION
Echo hi!
Endlocal
7z e -o"C:\test" -i!*.jar "C:\*.zip"
SETLOCAL ENABLEDELAYEDEXPANSION
Echo hi!
我想把这个在不同的蝙蝠,需要 SETLOCAL ENABLEDELAYEDEXPANSION
运行
推荐答案
您可以这样解决问题:
set bang=!
SETLOCAL ENABLEDELAYEDEXPANSION
Echo hi!
7z e -o"C:\test" -i!bang!*.jar "C:\*.zip"
只是要确保设置砰!=
时延迟扩展禁用命令执行。
Just be sure that the set bang=!
command is executed when delayed expansion is disabled.
这篇关于SETLOCAL ENABLEDELAYEDEXPANSION,中断SETLOCAL ENABLEDELAYEDEXPANSION,SETLOCAL ENABLEDELAYEDEXPANSION的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!