批处理for 循环里使用if goto,当goto :loop之后循环就终止了,为什么,怎么解决。
@echooffclsSETLOCALENABLEDELAYEDEXPANSIONmd12for%%Qin(1,2)do(for%%Win(1,2)do(ifnotexi...
@echo off
cls
SETLOCAL ENABLEDELAYEDEXPANSION
md 12
for %%Q in (1,2) do (
for %%W in (1,2) do (
if not exist "%%Q%%W" goto loop else goto 1
:1
set /a var+=1
ECHO the !var!th one is done
:loop
echo.
)
)
rd 12
pause 展开
cls
SETLOCAL ENABLEDELAYEDEXPANSION
md 12
for %%Q in (1,2) do (
for %%W in (1,2) do (
if not exist "%%Q%%W" goto loop else goto 1
:1
set /a var+=1
ECHO the !var!th one is done
:loop
echo.
)
)
rd 12
pause 展开
2个回答
推荐于2016-08-01
展开全部
@echo off
cls
SETLOCAL ENABLEDELAYEDEXPANSION
md 12
for %%Q in (1,2) do (
for %%W in (1,2) do (
set "folder=%%Q%%W"
call :subroute
)
)
rd 12
pause
exit
:subroute
if not exist !folder! goto loop
:1
set /a var+=1
ECHO the !var!th one is done
goto :eof
:loop
echo.
goto :eof
cls
SETLOCAL ENABLEDELAYEDEXPANSION
md 12
for %%Q in (1,2) do (
for %%W in (1,2) do (
set "folder=%%Q%%W"
call :subroute
)
)
rd 12
pause
exit
:subroute
if not exist !folder! goto loop
:1
set /a var+=1
ECHO the !var!th one is done
goto :eof
:loop
echo.
goto :eof
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询