1.

Solve : Simple bat not working. Need some hints...?

Answer»

My ISP queues mail while my SMTP server is unavailable and unfortunately also sometimes queues it even while the SMTP server IS available. So, in order to dequeue the mail I run a finger command in a command window by typing: Code: [Select]finger [emailprotected]
This runs properly and returns the number of emails waiting to be dequeued and then returns to the command prompt once the QUEUE has been emptied. Now I don't want to have to keep doing doing this so I thought I could just enter that line into a bat file and SCHEDULE it to run every hour. However when I do that and run it, the command window opens and the command is run very quickly over and over again until I close the window.

How should the bat file be written to just run the command once (properly) then EXIT?Did you put this in a BAT file?
Please include the full contents of the BAT.
Hi Geek-9pm

I simply put that line into a text file and saved it with a .bat extension. (I also tried with a .cmd extension with the same results). I also tried it with pause after the line but that didn't do anything either.

BAT file content:

finger [emailprotected]


Thanks

A
Try replacing that FINGER with PINGQuote

However when I do that and run it, the command window opens and the command is run very quickly over and over again until I close the window.

How should the bat file be written to just run the command once (properly) then exit?

You problem can be recreated if the batch file is named finger and you're logged into the same directory where finger.bat lives. If that is the case, simply RENAME your batch file.

Just a thought. Sidewinder, that's brilliant! Your are a genius!
I could not duplicate what he did. That explains it!
The command interpreter always LOOKS in the current directory for a fie before looking into the PATH. That also explains why it was so quick. Finger can take a few seconds. But the command interpreter did do invoke the real finger executable, instead recursively called the bat file name 'finger'.

Kind of like taking two mirrors and looking at your face...face...face...face...face.....I concur - sidewinder is indeed a genius. The file was in fact named Finger.bat (Doh!) so I renamed it to dequeue.bat and it works perfectly now. Thanks to Sidewinder and all those who PM'd me with suggestions.


Discussion

No Comment Found