1

我正在尝试制作一个像聪明的机器人一样的程序,但是当使用空格时它就不起作用了。请帮忙。(:

@echo off
set text=Hello
:start
cls
echo %text%
set /p input=:
if %input%==a b set text=It worked
goto start
4

1 回答 1

3

使用引号:

@echo off
set text=Hello
:start
cls
echo %text%
set /p input=:
if "%input%"=="a b" set text=It worked
goto start

它还将处理空输入。

莫娜

于 2013-11-11T01:11:01.590 回答