1

So here's my 'if not' part of my code:

:open
set/p g=Choice:
if %g%== 1 goto FNVEnd
if %g%== 2 goto KSPEnd
if %g%== 3 goto SKYPEEnd
if not %g%==1|2|3 goto Correct2

:Correct2
cls
echo Welcome.
timeout 3
goto Open

Everything is working except the 'if not' part, please help!

4

2 回答 2

0

你根本不需要那条线。如果用户没有输入 1、2 或 3,则直接进入 Correct2。

您确定其他比较中的空间还可以吗?

你可能想试试这个:

:open
set/p g=Choice:
if "%g%"=="1" goto FNVEnd
if "%g%"=="2" goto KSPEnd
if "%g%"=="3" goto SKYPEEnd

REM If we get here ...
cls
echo Welcome.
timeout 3
goto Open
于 2013-08-04T19:14:17.403 回答
0

如果你想在这里检查你是否得到了正确的答案,你已经这样做了,失败将完成它。

如果您确实需要 IF THIS == THAT 或 THAT == THIS...,您将不得不使用 IF、ELSE。

REM  ::  AND
IF A==A IF B==B GOTO bothtrue

REM  ::  OR
IF A==A (
  GOTO oneorother
) ELSE (
  IF B==B GOTO oneorother
)

:bothtrue
 ECHO Both were true.
GOTO EOF
:oneorother
 ECHO AT least one was true.
于 2013-08-04T19:25:37.920 回答