@echo off
:start
cls
color e
echo YOU HAVE WON $1,000,000! WHAT WILL YOU DO?
echo.
echo =================
echo -Take it (1)
echo -Leave it (2)
echo -Double it (3)
echo =================
echo.
set /p INPUT=Please specify your answer:
If /i "%INPUT%" == "1" goto 1
If /i "%INPUT%" == "2" goto 2
If /i "%INPUT%" == "3" goto 3
If /i "%INPUT%" == "Jonah" goto Jonah
If /i "%INPUT%" == "" goto Wrong
我有一个奇怪的问题。以上是代码,出于某种原因,当我输入" INPUT"像Aiden'它会认为这意味着' 1'。有没有办法让每个错误的答案都变得错误。 (错误的答案就像艾登那样,甚至没有在那里指定。但不仅是艾登,还有其他任何事情。)
答案 0 :(得分:2)
在你的if语句之后,你需要放一个全能的GOTO语句,这样如果其他人都没有工作,那么它将会出错而不是继续进入下面的块
@echo off
:start
cls
color e
echo YOU HAVE WON $1,000,000! WHAT WILL YOU DO?
echo.
echo =================
echo -Take it (1)
echo -Leave it (2)
echo -Double it (3)
echo =================
echo.
set /p INPUT=Please specify your answer:
If /i "%INPUT%" == "1" goto 1
If /i "%INPUT%" == "2" goto 2
If /i "%INPUT%" == "3" goto 3
If /i "%INPUT%" == "Jonah" goto Jonah
goto Wrong