![]() |
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-12 06:05 |
47,811 topics / 349,897 posts / today 0 new / 48,256 members |
| DOS批处理 & 脚本技术(批处理室) » Dynamic password verification with a simulated progress bar |
| Printable Version 1,783 / 12 |
| Floor1 lj249911023 | Posted 2008-12-11 21:57 |
| 贫困用户 Posts 3 Credits -7 | |
|
```batch
@echo off &title Dynamic Password Verification ::::****************************************************************** ::::Explanation of getting the correct password: ::::If the displayed access time on the interface is Thursday, December 11, 2008, 21:13 ::::Then the correct password is the day + hour + minute, that is, the six-digit number 112113!!! ::::****************************************************************** ::::■〓■〓■〓■〓■ Program initialization starts ■〓■〓■〓■〓■ @mode con cols=101 lines=27 color 0a :mum call :xsp call :fz echo." ^-^ If you don't know the password, please press the Q key to exit this program! ^-^ echo. set /p name= Please enter the 6-digit access password: ::::Judge whether to exit the program. SET choice=%name:~0,1% if /i "%choice%"=="Q" goto endd ::::--------------------------------- SET name=%name:~0,6% ::::Start verifying the password::::::::: goto :pass ::::Password verification passed::::::::: :aabbcc :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::::The following can write the operation commands that can only be executed after passing the password verification. ::::::::::The following are some called procedures. That is, subroutines. goto :eof ::::::::::::: This is the first interface when the program runs :::::::::::::::: :xsp cls SET rq=%date:~0,16% SET sj=%time:~0,5% set mima=%rq% %sj% call :mima %mima% echo. echo. echo. """""""""""""""""""""""""""""""""""""""""""""""" echo. "┏━━━━━━━━━━━━━━━━━━━━━┓" echo. "┃ \\\|/// ┃" echo. "┃ \\ - - // ┃" echo. "┃ ( @ @ ) ┃" echo. "┃ ┏━━━━━━━━━oOOo-(_)-oOOo━┓ ┃" echo. "┃ ┃ ┃ ┃" echo. "┃ ┃ Hello! Welcome! ┃ ┃" echo. "┃ ┃ ┃ ┃" echo. "┃ ┃ Your access time this time is: ┃ ┃" echo. "┃ ┃ ┃ ┃" echo. "┃ ┃ %mima% ┃ ┃" echo. "┃ ┃ Oooo ┃ ┃" echo. "┃ ┗━━━━━━━━━ oooO ━( )━┛ ┃" echo. "┃ ( ) ) / ┃" echo. "┃ \ ( (_/ ┃" echo. "┃ \_) ┃" echo. "┗━━━━━━━━━━━━━━━━━━━━━┛" echo. """""""""""""""""""""""""""""""""""""""""""""""" echo. :::: pause goto :eof :::: Assign values to variables :fz set name= set aa1= set aa2= set aa3= set aa4= set aa5= set aa6= goto :eof :name echo. %1 set pass=%1 set aa1=%pass:~0,1% set aa2=%pass:~1,1% set aa3=%pass:~2,1% set aa4=%pass:~3,1% set aa5=%pass:~4,1% set aa6=%pass:~5,1% echo. %aa1%-%aa2%-%aa3%-%aa4%-%aa5%-%aa6% goto :eof ::::: Generate dynamic password :::::::::::::::::::::: :mima ::::echo. %1 %2 %3 set pass1=%1 set pass2=%2 set pass3=%3 set aa1=%pass1:~8,1% set aa2=%pass1:~9,1% set aa3=%pass3:~0,1% set aa4=%pass3:~1,1% set aa5=%pass3:~3,1% set aa6=%pass3:~4,1% ::::echo. %aa1%-%aa2%-%aa3%-%aa4%-%aa5%-%aa6% set pass=%aa1%%aa2%%aa3%%aa4%%aa5%%aa6% ::::echo. %pass% goto :eof ::::::Verify password:::::::::::::::::::::::::::::::: :pass :::: =====Display password verification status with simulated progress bar===== set a1= set b1= set c1= ::::■〓■〓■〓■〓■ Enable variable delay ■〓■〓■〓■〓■ setlocal enabledelayedexpansion :::------------------------------------------------------ ::::Here loop 100 times. The effect of calling subroutine:sub is to output 100 > to form >>>>>>>>>> for /l %%n in (1 1 100) do call :sub ::::■〓■〓■〓■〓■ Disable variable delay ■〓■〓■〓■〓■ setlocal DISABLEDELAYEDEXPANSION :::: ======================================= IF NOT "%pass%"=="%name%" goto :cw call :zq goto :aabbcc goto :eof ::::::Display information for incorrect password verification result:::::::::::::: :cw echo. Unfortunately, the access password you entered is invalid, please re-enter: pause goto :mum goto :eof ::::::Display information for correct password verification result:::::::::::::: :zq echo." ^-^ Congratulations! The password has passed verification! pause goto :eof rem ■〓■〓■The following is the subroutine for simulating the progress bar■〓■〓■ :sub rem -------------------------------------------- rem set /a c1= %c1% + 1 The command is abbreviated as follows: set /a c1+=1 rem -------------------------------------------- set /a a1=%c1% ::::Clear the screen and output 20 blank lines. cls && for /l %%n in (1 1 20) do echo. echo. echo Please be patient, verifying the password, completed !a1! %% rem After enabling variable delay effect for variable b1, add the > symbol to the original value of variable b1 and then assign it to variable b1 set b1=!b1!^>&& echo !b1! ping /n 1 127.0.0.1>nul goto :eof Trial download address of this batch processing http://upload.cn-dos.net/img/1185.rar http://upload.cn-dos.net/img/1185.rar :::: [ Last edited by lj249911023 on 2008-12-12 at 08:57 ] ``` |
|
| Floor2 HAT | Posted 2008-12-11 22:16 |
| 版主 Posts 5,017 Credits 9,023 | |
|
Q: How to add code tags to code for easy others to copy?
A: http://www.cn-dos.net/forum/viewthread.php?tid=43735#pid304733 Reference: http://www.cn-dos.net/forum/faq.php?page=misc#1 |
|
| Floor3 lj249911023 | Posted 2008-12-11 22:20 |
| 贫困用户 Posts 3 Credits -7 | |
|
Here are the translations:
Below are the effect pictures: ![]() If there are BUGs, experts please help correct. ::::****************************************************************** ::::Explanation for getting the correct password: ::::If the displayed access time on the interface is Thursday, December 11, 2008 21:13 ::::Then the correct password is day + hour + minute, that is, the six-digit number 112113!!! ::::****************************************************************** ![]() Thanks for providing opinions! Trial download address of this batch processing http://upload.cn-dos.net/img/1185.rar 》》 [ Last edited by lj249911023 on 2008-12-12 at 08:48 ] |
|
| Floor4 lisyofun | Posted 2008-12-11 23:51 |
| 初级用户 Posts 61 Credits 87 | |
| Floor5 rs369007 | Posted 2008-12-12 23:29 |
| 初级用户 Posts 131 Credits 147 | |
| Floor6 rs369007 | Posted 2008-12-12 23:55 |
| 初级用户 Posts 131 Credits 147 | |
|
Study more! Good ideas!
|
|
| Floor7 holucan | Posted 2008-12-13 14:23 |
| 初级用户 Posts 25 Credits 26 | |
|
Hehe, I'll also take it away and study it slowly.
|
|
| Floor8 exzzz | Posted 2008-12-15 17:36 |
| 初级用户 Posts 167 Credits 194 | |
|
I think the algorithm is the key. If it's obtained using hours, minutes and seconds, I think it can be completely implemented with more concise code.
The following progress bar... It seems to have no practical meaning? In addition, there is a problem in the place where Q is judged at the top. If the user enters the password as QXXX, it will also exit. [ Last edited by exzzz on 2008-12-15 at 17:37 ] |
|
| Floor9 freezing2688 | Posted 2009-06-01 01:01 |
| 新手上路 Posts 8 Credits 8 | |
| Floor10 740011611 | Posted 2009-06-20 06:21 |
| 初级用户 Posts 83 Credits 96 From 信阳 | |
|
Admired to the point of complete折服!
|
|
| Floor11 vobinedo | Posted 2009-06-20 21:52 |
| 新手上路 Posts 7 Credits 7 | |
|
Can the password be changed into *** symbols?
|
|
| Floor12 newxso | Posted 2009-06-20 22:55 |
| 初级用户 Posts 101 Credits 73 From GZ | |
| Floor13 yovie | Posted 2009-06-21 22:39 |
| 初级用户 Posts 42 Credits 92 From 重庆市巫山县 | |
|
The building above, yours is also too long?
Just post one occasionally, but it doesn't support special characters like F1, F2, etc., hehe:)
[ Last edited by yovie on 2009-6-21 at 22:47 ] |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |