Batch file 批次:如果选择不等于,则重新开始
试图在批处理文件中设置一些基本验证,但不断出现语法错误。基本上,3个选项,如果输入的不是1、2或3,我想从头开始Batch file 批次:如果选择不等于,则重新开始,batch-file,cmd,Batch File,Cmd,试图在批处理文件中设置一些基本验证,但不断出现语法错误。基本上,3个选项,如果输入的不是1、2或3,我想从头开始 set input= set /p input=Choice: if %input%==1 goto 1 if %input%==2 goto 2 if %input%==3 goto 3 if not %input%==1 if not %input%==2 if not %input%==3 @echo Not a valid choice goto Start 谢谢您根本不
set input=
set /p input=Choice:
if %input%==1 goto 1
if %input%==2 goto 2
if %input%==3 goto 3
if not %input%==1
if not %input%==2
if not %input%==3
@echo Not a valid choice
goto Start
谢谢您根本不需要这三条
语句
:start
set input=
set /p input=Choice:
if %input%==1 goto 1
if %input%==2 goto 2
if %input%==3 goto 3
@REM If you got here, it wasn't 1, 2, or 3
@echo Not a valid choice
goto start
:1
DoWhatever
goto end
:2
DoSecondWhatever
goto end
:3
DoThirdThing
:end