To my astonishment (I've use batch files for years and never seen
anything like this!) the first line of the batch file goes into an
infinite loop without executing in the batch file goes no further.
Each individual line of the batch file works fine from a command
prompt. To my even greater astonishment, our daughter's old XP machine
does exactly the same thing with batch files.
I must confess to being completely mystified by this behavior. Can
anyone explain what is going on—and how to fix it?
Thanks in advance!
Lemme take a stab in the dark - for example a command in the batch file is
NET USE and the batch file is called NET.BAT or NET.CMD ???
That kind of gotcha hits us all at one time or another, but if it's not the
reason then some more detail is needed... post the batch file.
> explain what is going on - and how to fix it?
It is almost essential to know what looping line is, but the most common
fault is invoking a program that has the same base name as the batch file,
i.e., a batch file named notepad.bat containing the command "notepad" will
make a mess for sure if it is run from the directory containing the batch
file.
--
T.E.D. (tda...@mst.edu)
Bingo--that's exactly it! Thanks so very much!!!!
This thread reminds me of the NPR "Car Talk" show.
Only here it would be "Bit and Byte" instead of "Click and Clack".
http://en.wikipedia.org/wiki/Car_Talk
But "Stump the Chumps" would probably still apply as well here as there. <grin>
- Larry
*** Absolutely. That is one of the reasons I always write the path and
file extension for any command issued by a batch file. This won't help if
a batch file command is the batch file name and the latter is in the same
directory, of course.
While I am on the subject, be aware of the order taken by DOS in
order to invoke a command:
When a command is issued, DOS first looks at DOSKEY or Toddy
Macros, 4DOS Aliases, or their equivalents as available from other
similar programs. Next it looks for an internal command of the name typed
at the command line. If it doesn't find a match, it searches through the
current directory. If a command (.com), executable (.exe), or batch
(.bat), (.btm) match is not found there, and if there are no appended
directories, DOS refers to the path statement to see in which other
directories it may look. In each of those directories DOS again searches
for a matching command, executable, or batch file.
One can save much of this searching if one issues both the complete
path and file extension for any command.
--
Richard Bonner
http://www.chebucto.ca/~ak621/DOS/