请在这个时候Goto出乎意料

时间:2016-02-26 19:40:35

标签: batch-file

我正在搞一个我可以输入的秘密文件并在这里​​保留自己的代码

@echo off
echo PLEASE ENTER THE PASSWORD TO CONTINUE
set /p password="hello"
IF %c%==hello goto top
IF NOT %c%==goto PASSERROR
:passsuccess
title matrix
color 0a
mode 1000
:top
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%%random%
goto top
:passerror
echo try again

1 个答案:

答案 0 :(得分:1)

您的问题是c未定义。您输入的密码为password,然后检查c

如果是空格或没有条目,请使用

if "%varentered%"=="somevalue" goto ...

例如,

if "%c%"=="" goto paserror

if not defined c goto ...

如果%c%不等于goto,请执行可执行文件passerror