[comp.sys.ibm.pc] Oooh Yeccheo. How Does This One Really Work?!?

myxm@beta.UUCP (Mike Mitchell) (12/05/87)

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
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

Now I get this when I turn the machie on! ...

<<CLEAR SCREEN>> <<HELLO COUNT RAM>> <<NOW HANG ON WHILE I BOOT TO DOS>>
;c:\dos;c:\freen;c:\gunk
Command not found
C:\> echo this is only a test and if you buy it you are a potato head
this is only a test and if you buy it you are a potato head
C:\> echo if you realy think you are cool than you will jot down the date
if you realy think you are cool than you will jot down the date

and it continus from there. what i want to do is have an autoexec.bat file
do a couple of wierd commands wait a little bit and then reboot with no
trace.

this does not work the way i would expect it to with the autoexec.bat file.
what i would like is no trace at all.

any suggestions?

thank you.

mike mitchell
myxm@lanl.gov
...!cmcl2!lanl!myxm

rjchen@phoenix.Princeton.EDU (Raymond Juimong Chen) (12/07/87)

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:

><<CLEAR SCREEN>> <<HELLO COUNT RAM>> <<NOW HANG ON WHILE I BOOT TO DOS>>
>;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

zu@ethz.UUCP (Urs Zurbuchen) (12/09/87)

In article <1269@phoenix.Princeton.EDU> rjchen@phoenix.Princeton.EDU (Raymond Juimong Chen) writes:
>In article <13091@beta.UUCP> it was written:
>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

You could the same thing without changing your AUTOEXEC.BAT. With the solution
presented above you will execute the same second version of AUTOEXEC.BAT each
time you reboot your machine (perhaps that's really what you want, but my
imagination doesn't go that far. If so, just disregard this article).

My solution: In the startup file you include the following:

if exist <filename_like_gaga.gag_or_whatever_you_want_to_call_it> goto second
<here included all the stuff you want executed when booted for the first time>
echo gaga > <filename_like_gaga.gag_or_whatever_you_want_to_call_it>
:second
<now follows the rest of the story (i.e. your autoexec.ddd)>

That's it. If you want to toggle between the two boot modes just add a line
like:

del <filename_like_gaga.gag_or_whatever_you_want_to_call_it>


		I hope this will help anybody :-)

			...urs


UUCP: ...seismo!mcvax!cernvax!ethz!zu

del@Data-IO.COM (Erik Lindberg) (12/11/87)

In article <13091@beta.UUCP> myxm@beta.UUCP (Mike Mitchell) writes:
>I want to have a file called C:\AUTOEXEC.DDD that looks like this:
>
     ......
>rem Now I want the machine to do a Ctrl/Alt/Del Warmboot at this point
>reboot
>
>Now I get this when I turn the machie on! ...
>
><<CLEAR SCREEN>> <<HELLO COUNT RAM>> <<NOW HANG ON WHILE I BOOT TO DOS>>
>;c:\dos;c:\freen;c:\gunk
>Command not found

You have already seen (if paying attention) an explanation of *why* you saw
the behaviour you did. What you didn't see was an viable workaround that
left NO TRACE of it's previous presence. The previous poster suggested
running a "doit.bat", but then you are left with doit.bat still there and
no way to really delete it.

I take particular perverted pleasure in setting things like this up for folks,
so here is the best way I have determined to do it. Rename their config.sys
to config.ddd. Rename their autoexec.bat to autoexec.ddd. Install a config.sys
which uses device=vdisk.sys (or omit this if they already use a vdisk.sys
in config.sys). Determine which drive vdisk.sys will be installed as (by
rebooting if necessary). Lets assume the ram disk will be drive v:
Your new autoexec.bat should contain:

if not "%1" == "" goto doit
copy autoexec.bat v:
v:autoexec foobar

:doit
rem this is the real stuff.... insert your joke here
:exit
del config.sys
rename config.ddd config.sys
del autoexec.bat
rename autoexec.ddd autoexec.bat
reboot

-- 
del (Erik Lindberg) 
uw-beaver!tikal!pilchuck!del