batch files appear to "hang"

M

Mick

Hello.

On occasion, I have noticed that when running batch files under Win2k pro
(SP3) and Win2k server (SP3), that sometimes cmd.exe will hang during the
processing of the batch file. If left it to run unattended, then what has
been observed is that sometimes the batch will continue processing after
several minutes or sometimes it will hang indefinitely (longest has been
10 hours) until I intervene by pressing the Enter key on the keyboard.

One way around this I have found, is to press the Enter key several times
in succession when the batch file first starts, thereby storing the
keycode for "Enter" in the keyboard buffer. So it appears that during
those times when cmd.exe appears to hang, for some reason it has actually
actually paused - looking for a CR/LF keycode combination in the keyboard
buffer.

I have also seen this "hang" (or waiting for CR/LF) occur not only with my
own batch files, but also during the installation or deinstallation of
those 3rd party commercial software which run certain CLI programs such as
regsvr.exe et al.

However, the batch files which I have written are run from the scheduler
over the weekend - so my being present to hit the Enter key at the
commencement of the batchfile being processed is not an option.

So does anyone here have any idea as to how this problem can be rectified?

Thankyou In Advance,
Mick
 
M

Mark Zbikowski \(MSFT\)

It is likely that some program being run in the .BAT file is requiring
input. You'd need to look into the .bat files to see what is happening.
I'd first try to remove the "echo off" statements so you can actually
view the execution. At the point where it hangs, it should be pretty
obvious what program is running.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top