我正在尝试编写一个批处理来在一夜之间执行一个脚本,以获取一个直到深夜才会创建的路径。如果路径存在,我希望循环总共检查 12 次。如果它确实存在,那么我希望它启动脚本测试。如果它不存在,那么我希望它休眠一个小时并再次检查。我还希望循环告诉我它每次循环了多少次。这是我所拥有的...
@Echo off
cls
set build = %1
set counter = 1
for /l %%a in (1,1,12) do (
if exist {%build%} (
goto StartTest
)
set Timer = %counter% + %Timer%
echo build does not exist. %Timer% out of 12 hours left for the build path to exist or this script will exit.
Sleep 3600000
)
goto end
:StartTest
Echo Starting Tests...
:end
Echo Times up, build path wasn't made
So far this has been the output in cmd:
build does not exist. out of 12 hours left for the build path to exist or this
script will exit stop trying.
'Sleep' is not recognized as an internal or external command,
operable program or batch file.
build does not exist. out of 12 hours left for the build path to exist or this
script will exit stop trying.
'Sleep' is not recognized as an internal or external command,
operable program or batch file.
build does not exist. out of 12 hours left for the build path to exist or this
script will exit stop trying.
'Sleep' is not recognized as an internal or external command,
operable program or batch file.
build does not exist. out of 12 hours left for the build path to exist or this
script will exit stop trying.
'Sleep' is not recognized as an internal or external command,
operable program or batch file.
build does not exist. out of 12 hours left for the build path to exist or this
script will exit stop trying.
'Sleep' is not recognized as an internal or external command,
operable program or batch file.
build does not exist. out of 12 hours left for the build path to exist or this
script will exit stop trying.
'Sleep' is not recognized as an internal or external command,
operable program or batch file.
build does not exist. out of 12 hours left for the build path to exist or this
script will exit stop trying.
'Sleep' is not recognized as an internal or external command,
operable program or batch file.
build does not exist. out of 12 hours left for the build path to exist or this
script will exit stop trying.
'Sleep' is not recognized as an internal or external command,
operable program or batch file.
build does not exist. out of 12 hours left for the build path to exist or this
script will exit stop trying.
'Sleep' is not recognized as an internal or external command,
operable program or batch file.
build does not exist. out of 12 hours left for the build path to exist or this
script will exit stop trying.
'Sleep' is not recognized as an internal or external command,
operable program or batch file.
build does not exist. out of 12 hours left for the build path to exist or this
script will exit stop trying.
'Sleep' is not recognized as an internal or external command,
operable program or batch file.
build does not exist. out of 12 hours left for the build path to exist or this
script will exit stop trying.
'Sleep' is not recognized as an internal or external command,
operable program or batch file.
Times up, build path wasn't made
C:\Users\james\Desktop>
注意它是如何说sleep
是一个无法识别的命令并且%Timer%
是空白的