中国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-08 05:42
48,041 topics / 350,128 posts / today 3 new / 48,253 members
DOS批处理 & 脚本技术(批处理室) » [Help] Modify the batch file's own password
Printable Version  1,804 / 11
Floor1 fourme2009 Posted 2008-04-13 11:59
初级用户 Posts 24 Credits 61
The following is a piece of code. Enter the correct password 123456 to enter the password modification. Please write the one who is good at modifying their own password: 123456

@echo off
chcp 437>nul&graftabl 936>nul
echo hP1X500Pf3/f1/5++u5x>in.com
set /p password=Please enter password:<nul
for /f "tokens=*" %%i in ('in.com') do set password=%%i
del in.com
echo.
if /i "%password%"=="123456" goto 密码修改
echo Wrong password: "%password%"
echo The program will automatically exit after 3 seconds.
ping -n 3 127.0.0.1>nul
exit

:密码修改
cls
echo Please complete the modification of the 123456 password
pause
Floor2 fourme2009 Posted 2008-04-13 12:26
初级用户 Posts 24 Credits 61
No, I can't get to the password modification page.
Floor3 fourme2009 Posted 2008-04-13 12:48
初级用户 Posts 24 Credits 61
Just found relevant information, and the problem has been solved!
Floor4 bat-zw Posted 2008-04-13 13:13
金牌会员 Posts 1,276 Credits 3,105
When testing, I removed the password hiding. Please the owner add it by himself.

ps Please the owner post your method to learn together.

[ Last edited by zw19750516 on 2008-4-17 at 08:11 PM ]
Floor5 fourme2009 Posted 2008-04-13 14:40
初级用户 Posts 24 Credits 61
This is found from the forum, it feels very good!
@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 For the safety of user settings, this program requires an administrator 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 it 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 use program
pause>nul
Floor6 bat-zw Posted 2008-04-13 15:47
金牌会员 Posts 1,276 Credits 3,105
Originally posted by fourme2009 at 2008-4-13 14:40:
This is found from the forum, and it feels very good!
@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 ...

Two files are generated, one of which is a temporary xmm.txt file, and the other is an m.rqm file. Strictly speaking, it doesn't count as self-modification. And my method doesn't generate any temporary files. Please compare it yourself, the landlord.

[ Last edited by zw19750516 on 2008-4-13 at 03:51 PM ]
Floor7 txa Posted 2008-04-27 12:44
新手上路 Posts 1 Credits 2
Floor8 dslz666 Posted 2008-04-28 01:14
中级用户 Posts 117 Credits 233
Originally posted by zw19750516 at 2008-4-13 01:13 PM:
I removed the password hiding during testing, please add it yourself, the landlord.


It is better to add an empty line before echo :: %pwd%>>%~nx0,
to avoid the new password and the old password being on the same line,
then, changing the password makes you not know what the password is yourself

For example:

echo Password modified successfully, new password is %pwd%
echo.>>%~nx0
echo :: %pwd%>>%~nx0
pause&goto :eof
:: 123456
Floor9 mmfy Posted 2009-08-03 08:57
新手上路 Posts 5 Credits 6
First, echo set mima=新密码>%0.txt
Then type %0>>%0.txt
ren %0.txt %0
Floor10 ZJHJ Posted 2009-08-08 00:07
高级用户 Posts 374 Credits 609
Modifying the batch file's own password is not the best strategy. Because if there is an error, your batch will be broken.
Floor11 shim Posted 2009-10-02 16:33
初级用户 Posts 73 Credits 85
Originally posted by ZJHJ at 2009-8-8 12:07 AM:
Modifying the password of the batch file itself is not the best strategy. Because once there is an error, your batch will crash.

I agree with the gentleman. o(∩_∩)o...
Floor12 qingfushuan Posted 2009-10-04 17:28
高级用户 Posts 327 Credits 502
Come on, what I want is that P runs once and then deletes itself. Thanks to everyone above.
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023