当我将用户名和密码留空时,表示客人此时出乎意料

时间:2014-02-22 22:33:53

标签: windows batch-file if-statement cmd

:lockdown
cls
echo Please Enter Your Username and Password to Play Game.
echo.
set /p user=Username: 
set /p word=Password: 
if /i %user% EQU guest goto main
if /i %user% EQU ryan (if /i %word% EQU %echo2% goto main)
if /i %user% EQU Ryan (if /i %word% EQU %echo2% goto main)
if /i %user% EQU tanner (if /i %word% EQU tanner goto main1)
if /i %user% EQU Tanner (if /i %word% EQU Tanner goto main1)
if /i %user% EQU austin (if /i %word% EQU austin goto main)
if /i %user% EQU Austin (if /i %word% EQU Austin goto main)
if /i %user% EQU duncan (if /i %word% EQU duncan goto main)
if /i %user% EQU Duncan (if /i %word% EQU Duncan goto main)

1 个答案:

答案 0 :(得分:0)

您必须在每个if行中设置双引号:

 if /i "%user%" EQU "guest" goto main