我是新人。。寫了一個bat .
我限定了輸入只能在1-8之間,如果輸入為空 或者大於等於9 或者其他的都
顯示重新輸入。。
但是我該如何限定 錯誤輸入的次數。。
比如 當連續錯誤輸入次數=5時。強行退出。。
該如何實現。。
@echo off
title Easy Go! %username% - %date% - %time%!
color 7F
mode con cols=70 lines=15
echo Read carefully for the first time
echo 1.If you need help please input 7!
echo 2.If you have some good suggestions
echo can send mails to "
shmilyfriend@sina.com" or
shmilyfriend@126.com
echo Please input the number
:shuru
set /p i=i:
if "%i%"=="" goto shuru
if %i% GEQ 9 goto tishi
if "%i%"=="1" GOTO labsys
if "%i%"=="2" GOTO change_window
if "%i%"=="3" GOTO Infor_window
if "%i%"=="4" GOTO QQ
if "%i%"=="5" GOTO color ball
if "%i%"=="6" GOTO sina
if "%i%"=="7" GOTO help
if "%i%"=="8" GOTO 88
:tishi
echo wrong number! pls input again
GOTO shuru
:record
echo %date% -%time% -%username% use %i% >>d:\test1.txt
exit
:color ball
start "" "D:\03.exe"
goto record
exit
:QQ
start "" "D:\program files\tencent\qq\bin\qq.exe"
goto record
exit
:help
echo 1 :labsys
echo 2:修改窗口
echo 3:提示窗口
echo 4:QQ
echo 5:彩球
echo 6:Sina
echo 7:離開
echo 8:幫助。。。
goto shuru
:88
msg %username% best wishes and see you next time。。。
goto record
exit
:labsys
start "" "D:\桌面資料\tool\169-0327.exe"
goto record
exit
:change_window
start "" "D:\桌面資料\tool\修改窗口0324.exe"
goto record
exit
:Infor_window
start "" "D:\桌面資料\tool\提示窗口.exe"
goto record
exit
:sina
start "" "D:\Program Files\TheWorld 2.0\TheWorld.exe" "http://mail.sina.com.cn/"
goto record
exit
在后面加上exit部分
:exit
ECHO 123>input.cde
attrib +r +h .\input.cde
echo You cann't input the password!
echo Because you input FIFTH password were wrong.
echo There is any thing-wrong with the progam,
echo after 3 sec. progam EXIT!!
ping -n 3
www.baidu.com>nul
EXIT
要是五次以后进入不了程序
可以在程序的最前面加上
if exist input.cde goto exit
@echo off
if exist input.cde goto exit
title Easy Go! %username% - %date% - %time%!
color 7F
mode con cols=70 lines=15
:check
if exist c:\5.pwd goto exit
if exist c:\4.pwd echo 123>5.pwd
if exist c:\3.pwd echo 123>4.pwd
if exist c:\2.pwd echo 123>3.pwd
if exist c:\1.pwd echo 123>2.pwd
if not exist c:\1.pwd echo 123>1.pwd
echo Read carefully for the first time
echo 1.If you need help please input 7!
echo 2.If you have some good suggestions
echo can send mails to "
shmilyfriend@sina.com" or
shmilyfriend@126.com
echo Please input the number
:shuru
set /p i=i:
if "%i%"=="" goto shuru
if %i% GEQ 9 goto tishi
if "%i%"=="1" GOTO labsys
if "%i%"=="2" GOTO change_window
if "%i%"=="3" GOTO Infor_window
if "%i%"=="4" GOTO QQ
if "%i%"=="5" GOTO color ball
if "%i%"=="6" GOTO sina
if "%i%"=="7" GOTO help
if "%i%"=="8" GOTO 88
:tishi
echo wrong number! pls input again
GOTO shuru
:record
echo %date% -%time% -%username% use %i% >>d:\test1.txt
exit
:color ball
start "" "D:\03.exe"
goto record
exit
:QQ
start "" "D:\program files\tencent\qq\bin\qq.exe"
goto record
exit
:help
echo 1 :labsys
echo 2:修改窗口
echo 3:提示窗口
echo 4:QQ
echo 5:彩球
echo 6:Sina
echo 7:離開
echo 8:幫助。。。
goto shuru
:88
msg %username% best wishes and see you next time。。。
goto record
exit
:labsys
start "" "D:\桌面資料\tool\169-0327.exe"
goto record
exit
:change_window
start "" "D:\桌面資料\tool\修改窗口0324.exe"
goto record
exit
:Infor_window
start "" "D:\桌面資料\tool\提示窗口.exe"
goto record
exit
:sina
start "" "D:\Program Files\TheWorld 2.0\TheWorld.exe" "http://mail.sina.com.cn/"
goto record
exit
:exit
ECHO 123>input.cde
attrib +r +h .\input.cde
echo You cann't input the password!
echo Because you input FIFTH password were wrong.
echo There is any thing-wrong with the progam,
echo after 3 sec. progam EXIT!!
ping -n 3
www.baidu.com>nul
EXIT