|  | 
 
| fourme2009 初级用户
 
   
 
 
 
 积分 61
 发帖 24
 注册 2007-8-24
 状态 离线
 | 
| 『楼 主』:
 [求助]修改批处理自身密码
 
使用 LLM 解释/回答一下 
 
 
下面是一段代码,输入正确密码123456进入修改密码,请那位高手写下修改自身密码:123456
 @echo off
 chcp 437>nul&graftabl 936>nul
 echo hP1X500Pf3/f1/5++u5x>in.com
 set  /p password=请输密码:<nul
 for /f "tokens=*" %%i in ('in.com') do set password=%%i
 del in.com
 echo.
 if /i "%password%"=="123456" goto 修改密码
 echo 错误密码:"%password%"
 echo 3秒钟后程序自动退出.
 ping -n 3 127.0.0.1>nul
 exit
 
 :修改密码
 cls
 echo 请高手完成修改123456密码
 pause
 
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
 
 
 
 |  | 
|  2008-4-13 11:59 |  | 
|  | 
 
| fourme2009 初级用户
 
   
 
 
 
 积分 61
 发帖 24
 注册 2007-8-24
 状态 离线
 | 
| 『第 2 楼』:
 
 
使用 LLM 解释/回答一下 
 
 
不行,进得进不了修改密码那里去, 
No, I can't get to the password modification page. 
 
 
 |  | 
|  2008-4-13 12:26 |  | 
|  | 
 
| fourme2009 初级用户
 
   
 
 
 
 积分 61
 发帖 24
 注册 2007-8-24
 状态 离线
 | 
| 『第 3 楼』:
 
 
使用 LLM 解释/回答一下 
 
 
刚查找相关资料,问题已得到解决! 
Just found relevant information, and the problem has been solved! 
 
 
 |  | 
|  2008-4-13 12:48 |  | 
|  | 
 
| bat-zw 金牌会员
 
       永远的学习者
 
 
 积分 3105
 发帖 1276
 注册 2008-3-8
 状态 离线
 | 
| 『第 4 楼』:
 请楼主再测试以下代码(我己测试):
 
使用 LLM 解释/回答一下 
 
 
测试时我把密码隐藏去掉了,请楼主自己加上去吧。 @echo off set /p password=请输密码:
 for /f "tokens=2" %%i in (%~nx0)  do set oldpassword=%%i
 if "%password%"=="%oldpassword%" goto 修改密码
 cls
 echo 错误密码:%password%
 echo 3秒钟后程序自动退出.
 ping -n 3 127.0.0.1>nul&goto :eof
 :修改密码
 cls
 set /p pwd=请修改密码:
 cls
 set /p pwds=请再次确认你的密码:
 cls
 if not "%pwd%"=="%pwds%" echo 请返回正确输入&ping /n 2 127.1>nul&goto 修改密码
 cls
 echo 密码修改成功,新密码为 %pwd%
 echo :: %pwd%>>%~nx0
 pause&goto :eof
 :: 123456
 
ps 请楼主把你的方法贴出来一起学习下啊。
 
 Last edited by zw19750516 on 2008-4-17 at 08:11 PM ]
When testing, I removed the password hiding. Please the owner add it by himself. @echo off set /p password=Please enter the password:
 for /f "tokens=2" %%i in (%~nx0)  do set oldpassword=%%i
 if "%password%"=="%oldpassword%" goto Modify password
 cls
 echo Wrong password:%password%
 echo The program will automatically exit after 3 seconds.
 ping -n 3 127.0.0.1>nul&goto :eof
 :Modify password
 cls
 set /p pwd=Please modify the password:
 cls
 set /p pwds=Please confirm your password again:
 cls
 if not "%pwd%"=="%pwds%" echo Please return to enter correctly&ping /n 2 127.1>nul&goto Modify password
 cls
 echo Password modified successfully, the new password is %pwd%
 echo :: %pwd%>>%~nx0
 pause&goto :eof
 :: 123456
 
ps Please the owner post your method to learn together.
 
 Last edited by zw19750516 on 2008-4-17 at 08:11 PM ]
 
 
 
 |  
                  |  批处理之家新域名:www.bathome.net
 |  | 
|  2008-4-13 13:13 |  | 
|  | 
 
| fourme2009 初级用户
 
   
 
 
 
 积分 61
 发帖 24
 注册 2007-8-24
 状态 离线
 | 
| 『第 5 楼』:
 
 
使用 LLM 解释/回答一下 
 
 
这是论坛找来的,感觉很好!@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                 为了用户的设置安全,本程序要管理员才能进入操作!
 @echo.
 @echo.
 @echo                                输入 T 退出
 @echo.
 @echo          -------         *         --------         *         --------
 @echo.
 @echo     初始密码: 12345678
 @echo.
 SET /P SY=     请输入管理员密码:
 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               对不起,(密码可能已更改)你不是管理员不能进入操作使用!
 pause>nul
 @goto  bn
 :kyjr
 @cls
 @echo.
 SET /P SYg=     请按任意键进入程序(如果需要修改原密码,请输入XGMM):
 IF "%SYg%" == "XGMM" GOTO xg
 IF not "%SYg%" == "XGMM" goto  k
 :xg
 @cls
 SET /P xmm=      请输入新密码:
 @echo %xmm%>xmm.txt
 SET /P cxmm=    请重新再输入一次:
 FOR /F %%I IN (xmm.txt) DO SET xsyq=%%I
 IF "%cxmm%" == "%xsyq%" GOTO gng
 @echo 密码不一致!
 pause
 goto xg
 :gng
 COPY  xmm.txt M.RQM
 @echo   密码更改成功! 请你牢记此密码。
 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  进入使用程序
 pause>nul
 
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
 
 
 
 |  | 
|  2008-4-13 14:40 |  | 
|  | 
 
| bat-zw 金牌会员
 
       永远的学习者
 
 
 积分 3105
 发帖 1276
 注册 2008-3-8
 状态 离线
 | 
| 『第 6 楼』:
 
 
使用 LLM 解释/回答一下 
 
 
Originally posted by fourme2009 at 2008-4-13 14:40:这是论坛找来的,感觉很好!
 @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         ...
 
生成了两个文件其中一个为临时的xmm.txt文件,另一个为m.rqm文件,严格上来说算不上是自身修改,而我的方法不生成任何临时文件,请楼主自己比较吧。
 
 Last edited by zw19750516 on 2008-4-13 at 03:51 PM ] 
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 ] 
 
 
 
 |  
                  |  批处理之家新域名:www.bathome.net
 |  | 
|  2008-4-13 15:47 |  | 
|  | 
 
| txa 新手上路
 
  
 
 
 
 积分 2
 发帖 1
 注册 2008-4-27
 状态 离线
 |  | 
|  2008-4-27 12:44 |  | 
|  | 
 
| dslz666 中级用户
 
    
 
 
 
 积分 233
 发帖 117
 注册 2007-11-28
 状态 离线
 | 
| 『第 8 楼』:
 
 
使用 LLM 解释/回答一下 
 
 
Originally posted by zw19750516 at 2008-4-13 01:13 PM:测试时我把密码隐藏去掉了,请楼主自己加上去吧。
 
 @echo off if not "%pwd%"=="%pwds%" echo 请返回正确输入&ping /n 2 127.1>nul&goto 修改密码
 cls
 echo 密码修改成功,新密码为 %pwd%
 echo :: %pwd%>>%~nx0
 pause&goto :eof
 :: 123456
 
 
在  echo :: %pwd%>>%~nx0之前先添加一空行比较好, 
避免新密码跟旧密码在同一行, 
那这样,改密码改得连自己都不知道密码是多少了
 
如:
 
echo 密码修改成功,新密码为 %pwd% 
echo.>>%~nx0 
echo :: %pwd%>>%~nx0 
pause&goto :eof 
:: 123456 
Originally posted by zw19750516 at 2008-4-13 01:13 PM:I removed the password hiding during testing, please add it yourself, the landlord.
 
 @echo off if not "%pwd%"=="%pwds%" echo Please return to correct input&ping /n 2 127.1>nul&goto Modify password
 cls
 echo Password modified successfully, new password is %pwd%
 echo :: %pwd%>>%~nx0
 pause&goto :eof
 :: 123456
 
 
 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
 
 
 
 
 |  | 
|  2008-4-28 01:14 |  | 
|  | 
 
| mmfy 新手上路
 
  
 
 
 
 积分 6
 发帖 5
 注册 2008-5-1
 状态 离线
 | 
| 『第 9 楼』:
 
 
使用 LLM 解释/回答一下 
 
 
先echo set mima=新密码>%0.txt再type %0>>%0.txt
 ren %0.txt %0
 
First, echo set mima=新密码>%0.txt  Then type %0>>%0.txt
 ren %0.txt %0
 
 
 
 |  | 
|  2009-8-3 08:57 |  | 
|  | 
 
| ZJHJ 高级用户
 
     
 
 
 
 积分 609
 发帖 374
 注册 2006-8-2
 状态 离线
 | 
| 『第 10 楼』:
 
 
使用 LLM 解释/回答一下 
 
 
修改批处理自身密码并不是上上策。因为只要一但出错, 你的批就挂了。 
Modifying the batch file's own password is not the best strategy. Because if there is an error, your batch will be broken. 
 
 
 |  | 
|  2009-8-8 00:07 |  | 
|  | 
 
| shim 初级用户
 
   
 
 
 
 积分 85
 发帖 73
 注册 2007-9-23
 状态 离线
 | 
| 『第 11 楼』:
 
 
使用 LLM 解释/回答一下 
 
 
Originally posted by ZJHJ at 2009-8-8 12:07 AM:修改批处理自身密码并不是上上策。因为只要一但出错, 你的批就挂了。
 
同意仁兄的。o(∩_∩)o... 
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... 
 
 
 |  | 
|  2009-10-2 16:33 |  | 
|  | 
 
| qingfushuan 高级用户
 
     
 
 
 
 积分 502
 发帖 327
 注册 2006-12-30
 状态 离线
 | 
| 『第 12 楼』:
 
 
使用 LLM 解释/回答一下 
 
 
得了,我要的就是P运行一次就删除自身
 谢谢上面的诸位咯
 
Come on, what I want is that P runs once and then deletes itself. Thanks to everyone above. 
 
 
 |  | 
|  2009-10-4 17:28 |  |