China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-07 23:31
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Enter password to start the program (password can be changed) View 1,879 Replies 13
Original Poster Posted 2007-03-04 03:21 ·  中国 四川 泸州 联通
高级用户
★★★
Credits 609
Posts 374
Joined 2006-08-02 22:38
20-year member
UID 59720
Status Offline
I read the posts related to this, and it seems too complicated. I wrote a try. (If you think it's okay, please support it)
@echo off
if exist M.RQM goto bn
rem llts in 0070303schj by q@251485609
@echo 12345678>M.RQM
:bn
@cls
@echo off
@echo.
@echo.
@echo.
@echo To ensure the security of user settings, this program requires administrator privileges to enter and operate!
@echo.
@echo.
@echo Enter T to exit
@echo.
@echo ------- * -------- * --------
@echo.
@echo Initial password: 12345678
@echo.
SET /P SY= Please enter the administrator password:
FOR /F %%I IN (M.RQM) DO SET syq=%%I
IF "%SY%" == "%syq%" GOTO kyjr
IF "%SY%" == "CK" GOTO ckmm
IF "%SY%" == "T" GOTO :eof
@cls
@echo.
@echo.
@echo.
@echo Sorry, (the password may have been changed) you are not an administrator and cannot enter and operate!
pause>nul
@goto bn
:kyjr
@cls
@echo.
SET /P SYg= Please press any key to enter the program (if you need to change the original password, please enter XGMM):
IF "%SYg%" == "XGMM" GOTO xg
IF not "%SYg%" == "XGMM" goto k
:xg
@cls
SET /P xmm= Please enter the new password:
@echo %xmm%>xmm.txt
SET /P cxmm= Please enter again:
FOR /F %%I IN (xmm.txt) DO SET xsyq=%%I
IF "%cxmm%" == "%xsyq%" GOTO gng
@echo Password does not match!
pause
goto xg
:gng
COPY xmm.txt M.RQM
@echo Password changed successfully! Please remember this password.
pause>nul
goto bn
:ckmm
@cls
FOR /F %%I IN (M.RQM) DO SET syq=%%I
@echo %syq%
pause>nul
goto bn
:k
del xmm.txt
@cls
@echo Enter the usage program
pause>nul
Floor 2 Posted 2007-03-04 05:45 ·  中国 辽宁 朝阳 联通
铂金会员
★★★★
痴迷DOS者
Credits 5,798
Posts 1,924
Joined 2003-06-20 00:00
23-year member
UID 5583
Gender Male
From 金獅電腦軟體工作室
Status Offline
If you simply use batch processing without handling CTRL + C, it is very easy to be aborted. So I think it is also necessary to cooperate with some applications to control the keyboard to achieve the purpose that batch processing cannot be aborted during execution.
熟能生巧,巧能生精,一艺不精,终生无成,精亦求精,始有所成,臻于完美,永无止境!
金狮電腦軟體工作室愿竭诚为您服务!
QQ群:8393170(定期清理不发言者)
个人网站:http://www.520269.cn
电子邮件:doujiehui@vip.qq.com
微信公众号: doujiehui
Floor 3 Posted 2007-03-05 13:17 ·  中国 湖北 潜江 电信
高级用户
★★★
Credits 894
Posts 411
Joined 2007-02-17 12:15
19-year member
UID 79697
Gender Male
Status Offline
@set c= 不知则觉多,知则觉少,越知越多,便觉越来越少. --- 知多少.
@for,/l,%%i,in,(1,1,55)do,@call,set/p=%%c:~%%i,1%%<nul&ping/n 1 127.1>nul


Floor 4 Posted 2007-03-06 02:01 ·  中国 浙江 绍兴 诸暨市 电信
高级用户
★★★
Autowalk
Credits 845
Posts 375
Joined 2007-03-03 01:58
19-year member
UID 80606
Gender Male
Status Offline
Sweat, the file that saves the password can actually be opened with TXT. It's just that the TXT suffix was changed. Can it be changed to garbled code?
Floor 5 Posted 2007-03-06 10:29 ·  中国 四川 泸州 联通
高级用户
★★★
Credits 609
Posts 374
Joined 2006-08-02 22:38
20-year member
UID 59720
Status Offline
This method mainly doesn't want others to enable your program and destroy your own settings. This is just one method. As for the place and way to save the password, you can use your own brains.
Floor 6 Posted 2007-03-18 13:58 ·  中国 河南 商丘 联通
初级用户
Credits 154
Posts 22
Joined 2004-05-30 00:00
22-year member
UID 25621
Gender Male
Status Offline
Floor 7 Posted 2007-08-03 15:52 ·  中国 浙江 杭州 拱墅区 电信
初级用户
Credits 20
Posts 8
Joined 2007-08-02 15:19
19-year member
UID 94511
Gender Male
Status Offline
I don't have high requirements for password security, and this program is exactly what I need. Thanks a lot to the original poster.
Floor 8 Posted 2007-08-03 17:01 ·  中国 浙江 杭州 拱墅区 电信
初级用户
Credits 20
Posts 8
Joined 2007-08-02 15:19
19-year member
UID 94511
Gender Male
Status Offline
There seems to be some issues with the code. After modifying the password, when entering the password for the second time and pressing Enter, it goes back to the password modification instead of entering the execution program.
Floor 9 Posted 2007-08-03 21:38 ·  中国 四川 泸州 联通
高级用户
★★★
Credits 609
Posts 374
Joined 2006-08-02 22:38
20-year member
UID 59720
Status Offline
Because you didn't restart the program, the previous variables remain in the machine.
Floor 10 Posted 2008-03-21 12:23 ·  中国 湖北 武汉 电信
初级用户
Credits 24
Posts 17
Joined 2008-03-20 22:07
18-year member
UID 113537
Gender Male
Status Offline
Floor 11 Posted 2008-03-21 20:24 ·  中国 广东 韶关 电信
初级用户
Credits 114
Posts 36
Joined 2007-12-22 17:42
18-year member
UID 106486
Gender Male
Status Offline
Just add some encryption casually, then output it.
Floor 12 Posted 2008-03-24 18:57 ·  中国 河南 驻马店 汝南县 联通
初级用户
Credits 22
Posts 9
Joined 2008-03-21 10:57
18-year member
UID 113575
Gender Male
Status Offline
@echo off
color 0a
MODE con: COLS=50 LINES=27
set ci=3
echo.
echo Notice: Three incorrect inputs will exit. Don't enter if you don't know the password~~
echo.
:1
set /p mima=Please enter the password:
if "%mima%"=="123" goto o
set /a ci-=1
if "%ci%"=="0" cls&echo.&echo ====No password and still want to come in!!!====No way!!!====&echo.&pause&echo.&exit
cls&echo.&echo You have %ci% chances left&echo.&goto 1
:o
cls&echo.
echo ============ Password correct, access granted ============
Floor 13 Posted 2008-03-24 18:58 ·  中国 河南 驻马店 汝南县 联通
初级用户
Credits 22
Posts 9
Joined 2008-03-21 10:57
18-year member
UID 113575
Gender Male
Status Offline
The password upstairs is of course displayed in plain text inside. On the one hand, this can be encrypted, and on the other hand, it will be very convenient for people who have low requirements for passwords.
Floor 14 Posted 2008-03-24 22:32 ·  中国 北京 联通
银牌会员
★★★
Credits 1,287
Posts 634
Joined 2007-05-02 15:06
19-year member
UID 87277
Gender Male
From cmd.exe
Status Offline
Directly CTRL+C..
Use the automatic run in cmd, I just cmd /d
Forum Jump: