0
@echo off
pause
color 0a
mode 1000

set /p apps = where do you want to go to?
echo metrix = 1
echo nothing = 2
pause

if %apps% == 1 goto metrix
if %apps% == 2 goto nothing

:metrix
:start
echo %random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random% %random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random% %random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%%random%
goto start

:nothing
echo nothing
pause
exit

为什么它不起作用?

我从教程中复制了它,但我不知道为什么它不起作用。

4

2 回答 2

1

在以下语句中删除“=”前后的空格。

set /p apps = 你想去哪里?

于 2013-01-12T12:29:35.393 回答
0

除了 CuriousMind 的建议之外,您还应该以这种方式进行比较:

if "%apps%"=="1" goto metrix
if "%apps%"=="2" goto nothing

使用引号和删除多余的空格更安全。你可能还想写

echo metrix = 1
echo nothing = 2
set /p apps = where do you want to go to?

以便在问题之前显示回声。

于 2013-01-13T09:09:42.087 回答