我不知道这是否可行,所以我问你是否可以在批处理中将 FOR 放在 IF 中
@echo off
set alea=%random%%%100
echo Choisis la difficulte de 1 a 5 :
set /p level=
if %level% == 1 DO (
for /f "eol=; tokens=1-5 delims=," %%i IN (levels.txt) DO (
echo Level %%i
)
)
if %level% == 2 echo lvl 2
pause>nul
结果如下: