Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

First line of batch file keeps looping indefinitely

5,851 views
Skip to first unread message

jedpa...@gmail.com

unread,
Jan 14, 2010, 8:26:16 AM1/14/10
to
Yesterday I was helping our daughter by remote assistance with some
networking problems and, having finally resolve the networking
problems, by created a batch file to set up drive mapping on her new
Windows 7 machine.

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!

foxidrive

unread,
Jan 14, 2010, 8:50:49 AM1/14/10
to

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.

Ted Davis

unread,
Jan 14, 2010, 8:57:39 AM1/14/10
to

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

jedpa...@gmail.com

unread,
Jan 14, 2010, 9:16:05 AM1/14/10
to
On Jan 14, 8:50 am, foxidrive <got...@woohoo.invalid> wrote:
> On Thu, 14 Jan 2010 05:26:16 -0800 (PST), "no_spam_paque...@uwo.ca"

Bingo--that's exactly it! Thanks so very much!!!!

Larry__Weiss

unread,
Jan 14, 2010, 3:44:18 PM1/14/10
to
no_spam_...@uwo.ca wrote:
> On Jan 14, 8:50 am, foxidrive <got...@woohoo.invalid> wrote:
>> On Thu, 14 Jan 2010 05:26:16 -0800 (PST), "no_spam_paque...@uwo.ca"
>>
>> <jedpaque...@gmail.com> wrote:
>>> Yesterday I was helping our daughter by remote assistance with some
>>> networking problems and, having finally resolve the networking
>>> problems, by created a batch file to set up drive mapping on her new
>>> Windows 7 machine.
>>> 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?

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

Richard Bonner

unread,
Jan 20, 2010, 9:39:05 AM1/20/10
to
Ted Davis (tda...@mst.edu) wrote:
(Re: Circular References)

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

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

net...@elmospa.com

unread,
Feb 2, 2015, 5:42:33 AM2/2/15
to
thankssssssssssss!!
I called the file net.bat !!

thank you very much
I was going crazy
0 new messages