Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!rutgers!princeton!phoenix!rjchen From: rjchen@phoenix.Princeton.EDU (Raymond Juimong Chen) Newsgroups: comp.sys.ibm.pc Subject: Re: Oooh Yeccheo. How Does This One Really Work?!? Message-ID: <1269@phoenix.Princeton.EDU> Date: Mon, 7-Dec-87 14:41:23 EST Article-I.D.: phoenix.1269 Posted: Mon Dec 7 14:41:23 1987 Date-Received: Sat, 12-Dec-87 14:54:30 EST References: <164300022@uiucdcsb> <412@wa3wbu.UUCP> <13091@beta.UUCP> Reply-To: rjchen@phoenix.Princeton.EDU (Raymond Juimong Chen) Organization: Princeton University, NJ Lines: 71 Summary: Thou shalt not overwrite files behind DOS's back, at least not without good reason. Apologies to the net, but my mail bounced. In article <13091@beta.UUCP> it was written: >I want to have a file called C:\AUTOEXEC.DDD that looks like this: > >prompt $p$g >path c:\bin;c:\bat;c:\fluff;c:\dandruf;c:\batch;c:\dos;c:\freen;c:\gunk >echo this is only a test and if you buy it you are a potato head >echo if you realy think you are cool than you will jot down the date >echo and time now. >date >time > >Now, I have this other file C:\AUTOEXEC.BAT that looks like this... > >echo Eat this one foo bar! >copy c:\autoexec.ddd c:\autoexec.bat ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This is bad. >del c:\autoexec.ddd >echo You can do it too! >rem Now I want the machine to do a Ctrl/Alt/Del Warmboot at this point >reboot when you copy the autoexec.ddd to autoexec.bat, autoexec.bat gets overwritten, and you have essentially erased the program you are trying to execute! This is the reason for the strange events which follow: ><> <> <> >;c:\dos;c:\freen;c:\gunk ^^^^^^^^^^^^^^^^^^^^^^^^^^^ The batch file got as far as "copy \autoexec.ddd \autoexec.bat". When DOS looked for the next command in the file, it found somebody else inside the autoexec.bat file. Being stupid, DOS assumed that nothing happened at all and proceeds to continue execution from where it thinks it left off. Thus, you get a partial command and all the rest of the nonsense. (If you're really into that sort of thing, you could verify that the garbage command ";c:\dos;..." actually appears in the file autoexec.ddd exactly where the "del c:\autoexec.ddd" appears in the file autoexec.bat.) What you'd probably want is something like AUTOEXEC.BAT: doit DOIT.BAT: copy \autoexec.ddd \autoexec.bat del \autoexec.ddd do other stuff reboot. AUTOEXEC.DDD: same as before This time, when DOS copies autoexec.dd to autoexec.bat, nobody cares, since the current batch file is DOIT.BAT. It seems to me you're trying to pull a fast one on the normal person who boots up the computer. I shall not pass moral judgement. -- Raymond Chen UUCP: ...allegra!princeton!{pucc|phoenix}!rjchen BITNET: 6101695@pucc, rjchen@pucc ARPA: rjchen@pucc.PRINCETON.EDU "Say something, please! ('Yes' would be best.)" - The Doctor -- Raymond Chen UUCP: ...allegra!princeton!{pucc|phoenix}!rjchen BITNET: 6101695@pucc, rjchen@pucc ARPA: rjchen@pucc.PRINCETON.EDU "Say something, please! ('Yes' would be best.)" - The Doctor