![]() |
中国DOS联盟-- 联合DOS 推动DOS 发展DOS --联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum |
| 游客 | 登录 | 注册 | 会员 | 搜索 | 中国DOS联盟 |
|
中国DOS联盟论坛 现在时间是 2026-08-26 14:17 |
共 47,812 主题排行 / 349,910 发帖 / 今日 0 篇 / 48,264 会员排行 |
| 其它操作系统综合讨论区 » 錯誤輸入次數限制 |
| 可打印版本 1,754 / 8 |
| 第1楼 shmilyfriend | 发表于 2010-07-10 10:10 |
| 新手上路 发帖 3 积分 6 | |
|
錯誤輸入次數限制 我是新人。。寫了一個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 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 |
|
| 第2楼 doslike | 发表于 2010-07-10 11:18 |
| 版主 发帖 285 积分 326 来自 黑龙江省 | |
|
这很简单
在密码验证前面加上 :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 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 在这后面加上 if "%i%" gtr "8" goto |
|
| 第3楼 doslike | 发表于 2010-07-10 11:29 |
| 版主 发帖 285 积分 326 来自 黑龙江省 | |
|
在后面加上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 |
|
| 第4楼 shmilyfriend | 发表于 2010-07-10 12:12 |
| 新手上路 发帖 3 积分 6 | |
|
版主辛苦了。。我還是沒有弄明白。。!
|
|
| 第5楼 DOSroot | 发表于 2010-07-10 21:02 |
| 管理员 发帖 198 积分 389 | |
|
此帖转移自 DOS疑难解答 & 问题讨论 (解答室)
身为版主,更应以身作则遵守论坛相应规定 http://www.cn-dos.net/forum/viewthread.php?tid=46409 http://www.cn-dos.net/forum/viewthread.php?tid=46315 扣分予以提醒,望今后引起注意。 |
|
| 第6楼 doslike | 发表于 2010-07-12 09:40 |
| 版主 发帖 285 积分 326 来自 黑龙江省 | |
|
我以后一定注意
|
|
| 第7楼 doslike | 发表于 2010-07-12 09:43 |
| 版主 发帖 285 积分 326 来自 黑龙江省 | |
|
@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 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 |
|
| 第8楼 DOSroot | 发表于 2010-07-14 18:56 |
| 管理员 发帖 198 积分 389 | |
|
我认从为“回收站”移到“其它操作系统综合讨论区”不太合适,移到“批处理”版块显然比较适合。
|
|
| 第9楼 doslike | 发表于 2010-07-28 13:44 |
| 版主 发帖 285 积分 326 来自 黑龙江省 | |
|
批处理板块也收win的?
|
|
|
[ 联系联盟系统管理团队 -
中国DOS联盟 -
标准版 ] Sponsored by ifanr Inc | © 2001–2023 |