中国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-17 00:13
47,813 topics / 349,903 posts / today 0 new / 48,259 members
DOS疑难解答 & 问题讨论 (解答室) » Help a newbie take a look at how this batch file should be written!
Printable Version  649 / 1
Floor1 sysjinglin Posted 2004-09-18 00:00
初级用户 Posts 2 Credits 112
A friend asked me a few days ago to help him write a batch file so that after his computer boots twice, it would ask whoever boots it for a password. So I wrote the following, but the result is that no matter how many times it boots, it always asks for the password :-) It made me look really bad! I took another look, and it seems like the order is wrong, but I still can't figure out how it should actually be written. Could one of you experts help this newbie out? Thanks in advance!
@echo off
echo k >1.txt
if exist 2.txt goto over
if exist 1.txt goto 1
goto end
:1
ren 1.txt 2.txt
ver
c:\password
:end
exit
Floor2 willsort Posted 2004-09-18 00:00
元老会员 Posts 1,512 Credits 4,432
To sysjinglin:
  The main problem is that there is no Goto end after the line ren 1.txt 2.txt; and the goto end above is somewhat redundant.
  Also, this program still has problems in actual use. Asking for a password after being run twice is somewhat like a sharing restriction, but it is not suitable for use as a boot password, because the flaw that a batch file itself can be interrupted is quite serious, and the remedy is also rather troublesome. I suggest using it only for testing.
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023