![]() |
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-09-24 08:44 |
47,812 topics / 349,917 posts / today 0 new / 48,274 members |
| DOS批处理 & 脚本技术(批处理室) » Question: Batch file for password setting and password verification. |
| Printable Version 974 / 0 |
| Floor1 lianjiang2004 | Posted 2006-12-25 04:00 |
| 金牌会员 Posts 1,884 Credits 3,946 | |
|
Question: Batch file for password setting and password verification.
Below is a batch file for password setting and password verification that I wrote with reference to some posts. The problem is that as long as the file _pwda that stores the password is deleted, it becomes useless. Is there any way to solve this? Also, when entering it here, the password is shown in plain text. Is there any simple way to hide it in the form of ***? **************************************************************** :pwd set pwdam=0 If not Exist d:\gghost\temp\_pwda Goto pwd0 for,/f,"tokens=1",%%i,In (d:\gghost\temp\_pwda) Do ( set pwdam=%%i ) :pwd0 cls echo. echo Password Settings Echo. echo [1] Software administrator password echo [2] GRUB boot password (MD5) echo. Echo [0] Return to the main screen Echo [x] Exit Echo ------------------------------------------------- Echo. Set pwd= Set /P pwd= Please choose the operation to perform, then press Enter: If Not '%pwd%'=='' SET pwd=%pwd:~0,1% If /I '%pwd%'=='1' Goto pwda If /I '%pwd%'=='2' GOTO pwd2 If /I '%pwd%'=='0' GOTO BEGIN If /I '%pwd%'=='x' GOTO exit Goto pwd :pwda cls Echo. Echo. Echo Set administrator password Echo. Echo Note: 1. Please be sure to remember the software administrator password. If you forget it, you will not be able to set other passwords; Echo and this software cannot be uninstalled automatically. Echo 2. If you just press Enter directly, the administrator password will not be set. Echo --------------------------------------------------------- Echo Enter the administrator password you want to set Echo. Set /P pwda_1=Please enter: If %pwda_1%pwda_1==pwda_1 Goto pwd Echo. Echo. Echo Please enter your password again Echo. Set /P pwda_2=Please enter again: If %pwda_2%pwda_2==pwda_2 Goto pwd If Not %pwda_2%==%pwda_1% Echo.&&Echo The passwords you entered twice do not match, please re-enter&&Echo Please press any key to start setting the password again&&PAUSE >NUL&&Goto pwda set pwda=%pwda_2% grub\md5s.exe -d%pwda%>d:\gghost\temp\_pwda Echo. Echo. Echo Password has been set. Please remember your password, press any key to return... PAUSE>NUL Goto pwd :pwd2 if %pwdam%==0 goto pwd2a Echo. Echo. Echo. Set /P pwd2_0=Please enter the administrator password first: grub\md5s.exe -d%pwd2_0%>d:\gghost\temp\_ptemp2 for,/f,"tokens=1",%%i,In (d:\gghost\temp\_ptemp2) Do ( set pwd2_0m=%%i ) del d:\gghost\temp\_ptemp2 >nul If %pwd2_0m%==%pwdam% Goto pwd2a cls Echo. Echo Sorry! Incorrect administrator password, GRUB boot password cannot be set. Press any key to return... pause>nul Goto pwd :pwd2a cls Echo. Echo Set GRUB boot password (MD5) Echo. ...... Echo. Echo. Echo Password has been set. Please remember your password, press any key to return... pause>nul Goto pwd |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |