我需要遍历批处理文件中的列表,设置变量,退出循环然后重新输入。
if "%scale%" == "ind" (
FOR %%A IN %inclpeople% do (
set person=%%A
goto :start
:cyclepeople
echo Done %person%
)
goto :end
)
set person=%scale%
:start
echo Starting with %person%
call %batch%\findperson
if %errorlevel% neq 0 goto :failed
call %batch%\dosomethingelse
if %errorlevel% neq 0 goto :failed
:finish
if "%scale%" == "ind" (
goto :cyclepeople
)
:end
call %footer%\success
exit /b 0
所以,如果规模不是" ind" (在这种情况下,它可能是" all",然后只启动并运行命令一次。如果scale等于" ind",然后遍历一个人列表,将person设置为循环变量,转到开始并返回循环直到列表完成,然后结束。
目前,这仅适用于第一个循环和回声"完成亚当" (例如第一人称),但随后结束。
答案 0 :(得分:0)
为了将来参考,我将根据Stephan的评论回答这个问题:
if "%scale%" == "ind" (
FOR %%A IN %inclpeople% do (
set person=%%A
call :start
echo Done %person%
)
goto :end
)
set person=%scale%
:start
echo Starting with %person%
call %batch%\findperson
if %errorlevel% neq 0 goto :failed
call %batch%\dosomethingelse
if %errorlevel% neq 0 goto :failed
:finish
if "%scale%" == "all" (goto :end)
goto :eof
:end
call %footer%\success
exit /b 0