我已经努力找出我的if语句有什么问题......我可能错过了一些非常明显和愚蠢的东西,但我找不到它。
@Echo OFF
:Home
set Password= "Pass"
set /p input= Password:
if "%input%" == "%Password%" (
Echo Password Correct!
pause
)
if "%input%" "%Password%" (
Echo Password Incorrect!
cls
goto Home
)
这不起作用:
@Echo OFF
:home
set Password= "Pass"
set /p input=Password:
if "%input%" == "%Password%" goto correct
if "%input%" != "%Password%" goto incorrect
:correct
Echo Password Correct!
pause
:incorrect
Echo Password Incorrect!
cls
goto home
答案 0 :(得分:0)
试试这个
@Echo OFF
:Home
set Password=Pass
set /p input= Password:
if "%input%" == "%Password%" (
Echo Password Correct!
pause
) else (
Echo Password Incorrect!
goto Home
)
进行了3次更改
if
更改为if-else