Batch file 与';有关的问题在这个时候是出人意料的';基于文本的游戏中的批处理编码

Batch file 与';有关的问题在这个时候是出人意料的';基于文本的游戏中的批处理编码,batch-file,Batch File,我在尝试输入和输出输入时不断遇到这个问题。我不知道问题是什么,我想知道,这样我就不必每次遇到这个难题时都通过重新编程来解决它。下面是代码的样子: :A1 cls type A1intro.txt echo. echo. set input=5 set /p input=NOW WHAT? if %input%==HELP goto A1HELP if %input%==LOOK goto A1LOOK if %input%==LOOK AT BED goto A1BED ***this is

我在尝试输入和输出输入时不断遇到这个问题。我不知道问题是什么,我想知道,这样我就不必每次遇到这个难题时都通过重新编程来解决它。下面是代码的样子:

:A1
cls
type A1intro.txt

echo.
echo.
set input=5
set /p input=NOW WHAT? 
if %input%==HELP goto A1HELP
if %input%==LOOK goto A1LOOK
if %input%==LOOK AT BED goto A1BED ***this is where it says 'A1 not expected' once I type LOOK AT BED in the input***

goto A1


:A1BED ***So, this is where the A1 bed goes to and where the issue is with the code. No other command does this except this one. The others are identical in their coding.***

cls
type A1bed.txt
echo.
echo.
pause
goto A1

你需要在比较中加引号吗

if "%input%"=="LOOK AT BED" goto A1BED

你需要在比较中加引号吗

if "%input%"=="LOOK AT BED" goto A1BED

是的,您需要在第11行周围加引号,否则cmd.exe认为您的比较字符串只是
LOOK

是的,您需要在第11行周围加引号,否则cmd.exe认为您的比较字符串只是
LOOK