Strange .bat file behaviour

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a winlogon based image with a RAM based overlay protecting the C
partition; I then have two further partitions (D and E) which are just
standard partitions. The image was originally based on the explorer image,
but now has a custom shell. Essentially it’s not a very complex image.

The problem comes when I try to run batch files. If I launch a batch file
that contains the following lines:
echo %DATE% %TIME% >>d:\shutdown.log
shutdown –s –f –t 0
It doesn’t run once and shutdown the machine, but rather runs repeatedly
(for an infinite number of repetitions as far as I can tell). The
shutdown.exe doesn’t report any errors and the shutdown log is filled with
dates. Also if I just type shutdown –s –f –t 0 the machine does shutdown. Has
anyone got any ideas as to what might be going on?

Thanks for any help,
Rob
 
Rob White said:
I have a winlogon based image with a RAM based overlay protecting the C
partition; I then have two further partitions (D and E) which are just
standard partitions. The image was originally based on the explorer
image,
but now has a custom shell. Essentially it's not a very complex image.

The problem comes when I try to run batch files. If I launch a batch
file
that contains the following lines:
echo %DATE% %TIME% >>d:\shutdown.log
shutdown -s -f -t 0
It doesn't run once and shutdown the machine, but rather runs
repeatedly
(for an infinite number of repetitions as far as I can tell). The
shutdown.exe doesn't report any errors and the shutdown log is filled
with
dates. Also if I just type shutdown -s -f -t 0 the machine does
shutdown. Has
anyone got any ideas as to what might be going on?

Thanks for any help,
Rob

This sounds very similar to an issue I had with a batch file once (ok,
more than once...). The problem was that my batch file was named the
same as one of the external commands I was trying to issue. In other
words, if your batch file is named shutdown.bat, the shutdown command at
the end will run the batch file instead of the intended shutdown.exe if
the current directory is where the batch file is stored. Try either
renaming the batch file, changing to the directory where shutdown.exe is
located, or specifying the full path and file name of the shutdown.exe
(e.g. %SystemRoot%\system32\shutdown.exe -s -f -t 0)

Regards,

Dave
 
I wish it was that simple, the batch file was prefixed with TRex which, to my
knowledge, doesn't exist anywhere in XP.

Anyway I got bored of trying to figure out what was going on and simple
wrote my own shutdown app, which now works fine, all the time, everytime.

Rob
 
Back
Top