如何批量使用If Else语句

时间:2015-02-09 22:14:34

标签: batch-file

目前我正在编写一个简单的注册和登录系统的批处理文件。 我想这样做,以便程序将测试2个变量是否相同以及它们是否不同。这是我到目前为止所拥有的

@echo off
title Login
:a
cls
mode con: lines=10 cols=25
echo _________________________
echo     Select Your Choice
echo      1) Login
echo      2) Register
echo _________________________
set /p begi=:
if '%begi%'=='2' goto reg
if '%begi%'=='1' goto sign

:reg
cls
set u=
set /p u=Enter Your Username:
pause>nul
cls
set p=
set /p p=Enter your Password:
pause>nul
echo %u%>user.txt
echo %p%>pass.txt
pause>nul
goto a

:sign
cls
set /p "un="<user.txt
set /p "pa="<pass.txt
echo Enter you username
set uu=
set /p uu=:
pause>nul
if "%uu%"=="up" goto pa else goto mess


:pa
cls
echo Enter you password
set pp=
set /p pp=:
pause>nul
if "%pp%"=="%pa%" goto menu else goto mess


:menu
cls
color 2f
echo YAY
pause>nul
exit

:mess
color 4f
echo Access Denied
pause>nul
exit

0 个答案:

没有答案