中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-26 15:00
47,812 topics / 349,910 posts / today 0 new / 48,264 members
其它操作系统综合讨论区 » Error input count limit
Printable Version  1,756 / 8
Floor1 shmilyfriend Posted 2010-07-10 10:10
新手上路 Posts 3 Credits 6
I'm a new user.. I wrote a bat.. I limited the input to be only between 1-8. If the input is empty or greater than or equal to 9 or something else, it all displays to re-enter..

But how should I limit the number of wrong inputs.. For example, when the continuous wrong input count = 5, force exit.. How to implement..




@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
Floor2 doslike Posted 2010-07-10 11:18
版主 Posts 285 Credits 326 From 黑龙江省
This is very simple.
Add :check before password verification
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
Add after this
if "%i%" gtr "8" goto
Floor3 doslike Posted 2010-07-10 11:29
版主 Posts 285 Credits 326 From 黑龙江省
Add the exit part at the end:
: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 you can't enter the program after five times, you can add at the very beginning of the program:
if exist input.cde goto exit
Floor4 shmilyfriend Posted 2010-07-10 12:12
新手上路 Posts 3 Credits 6
The moderator has worked hard.. I still haven't figured it out..!
Floor5 DOSroot Posted 2010-07-10 21:02
管理员 Posts 198 Credits 389
This post is transferred from DOS Troubleshooting & Discussion (Q&A Room)

As a moderator, one should abide by the forum's corresponding regulations by setting an example.
http://www.cn-dos.net/forum/viewthread.php?tid=46409
http://www.cn-dos.net/forum/viewthread.php?tid=46315

Deduction of points is for reminder, hope to pay attention in the future.
Floor6 doslike Posted 2010-07-12 09:40
版主 Posts 285 Credits 326 From 黑龙江省
I will definitely pay attention in the future
Floor7 doslike Posted 2010-07-12 09:43
版主 Posts 285 Credits 326 From 黑龙江省
@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:Modify window
echo 3:Prompt window
echo 4:QQ
echo 5:Color ball
echo 6:Sina
echo 7:Exit
echo 8:Help...
goto shuru

:88
msg %username% best wishes and see you next time。。。
goto record
exit

:labsys
start "" "D:\Desktop Data\tool\169-0327.exe"
goto record
exit

:change_window
start "" "D:\Desktop Data\tool\Modify Window 0324.exe"
goto record
exit

:Infor_window
start "" "D:\Desktop Data\tool\Prompt Window.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
Floor8 DOSroot Posted 2010-07-14 18:56
管理员 Posts 198 Credits 389
I think it's not appropriate to move "Recycle Bin" to "Comprehensive Discussion Area of Other Operating Systems", and it's obviously more suitable to move it to the "Batch Processing" section.
Floor9 doslike Posted 2010-07-28 13:44
版主 Posts 285 Credits 326 From 黑龙江省
Does the batch processing section also accept Windows-related content?
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023