1.

Solve : Problem, batch file -> USE NET at startup win98?

Answer»

Hello everybody,

I am new to the forum and I have been scanning the site and the forum for a solution for my problem but I could not find it. I saw however that some of U guys really know your stuff.

So here goes.
I am trying to write a batch file that runs the COMMAND NET USE LPT1: \\... each time the windows 98 I use start.
The command works fine if I write it directly in MS-DOS prompt.
If I write a batch file and run it, it run over and over again. The same thing happens if I call it from autoexec.bat and execute it.
My code is basically the line written before in the text. I tried with ECHO OFF and some other commands that are listed on this site with connection to the batch files.

I would like to do another thing I did not even tried. I would llike to copy a specified folder over the network to a specified location, when windows stops. If the code is not totally I dont expect the whole solution. But I sign in the right direction (a command to use) would be fantastic.

10X in advanceGoing to need some additional information for this one.

First, what is the full command you're running that is causing this ISSUE, you only seemed to list the first part of the command.

Second it sounds as if you say that when you run this command it's causing a loop is there more to this batch file that you have or is it just this one line that you're running that is causing it to loop?Hello,

Basically that line is the whole of my code. As I am totally new to this I dont know what other lines to add. Like I said I tried with to use ECHO OFF or to to put the command in between a :BEGIN and an :END itd. I am sure I am forgetting to add something totally basic to the code in order to work fine.
I guess I need to work on the basics more the get the feel how writing batch files works.
So if I run the batch file with only the code NET USE LPT1: \\NETWORKCOMP\PRINTER the MS-DOS prompt appears and the line is running (appearing in the prompt) over and over agian until I close the whole thing. The call from autoexec.bet seems to work fine as the same thing happens when restarting the computer, only this time appearing on the whole screen and preventing the windows to start.

Hope my discription is precise enough.

CheersHmm still unable to duplicate the issue. I imagine that it is not the command that is causing your issue but the actual batch file you're running. Can you post the complete batch file you're attempting to use?My batch file attached.
You probably won't get any takers on the .zip file. Try posting the batch file in plain text.10x for teh tip:

The whole code:

NET USE LPT1: \\AMD\HP

Thats all

I probably need some support code - but what??If that's the only code in your batch file, then there is nothing to cause a loop. Either it will run or you will get an error MESSAGE concerning an UNKNOWN network or a unknown resource. What INDICATES you're in a loop? Is the network name and resource defined to the system?

Let us know. 8-)Quote

command in between a :BEGIN and an :END

You mentioned the above quote in one of your above messages. To me this sounds as if you've got some type of goto and/or other loop situation going. This line alone should not be causing any type of loop situation.hello all
I was just experimenting with :BEGIN and an :END, because my line keeps repeatng itself. And it did not help.

Sidewinder: If I type the command in MS-DOS prompt it is executed without a problem.
Some additional info:
If I run the batch file from my win 98 the MS-DOS prompt window opens and then the line runs over and over again.

I also tried something else:
I wrote the file as follows:
PAUSE
NET USE LPT1: \\NETCOMP\PRINTER

now when I run my file I am first asked to press a button to continue as the pause command is executed. When I press sth. my second line is written and the again the PAUSE command stops the execution.

Hope this helps...There are two ways to create a loop in a batch file. One is a goto which you obviously don't have. The other is recursion where a batch file calls itself. Since you claim that the two lines you posted are the only lines in your batch file and not part of larger batch file, I can only see a loop being created if your batch file is named net.bat

Just a thought. 8-)

PS. I searched for viruses that attack the command prompt and found none!Sidewinder you got it !!!!!!

The batch file was calling itself !!!!! Thats why it looped
What a stupid mistake on my part...

10x a lot to everybody for the help, specially sidewinder
Good thinking Sidewinder!


Discussion

No Comment Found