| 1. |
Solve : Batch to run ping loop? |
|
Answer» Hey guys, Basically I want to ping an ip constantly to keep a connection going So he needs to ping every minute or 10 minutes, etc., not every 10ms. If you know a way to do the QBASIC equivalent of SLEEP 10, suggest that. Mac would a simple way to do this be : :ping ping x.x.x.x wait 10 goto :pingBasically my iplist.txt is going to have a few different ips so I don't give 1 website the sh!ts by constantly pinging them. I am looking to send a ping out every few minutes to keep the connection established. while I try to figure out what another problem is. Cheers for the replies guys.The "wait 10" idea doesn't work in WindowsNT. WAIT is not a command. However, if you just want to stall to give hosts a break, try this Use my suggested BAT file (change filenames as desired) In the TXT file, put your real sites you want to ping and then FOLLOW by a zillion instances of your own IP address. By the time it gets through trying to ping them, some time would have elapsed.Qbasic cheers for that I will give it a try. What about this :ping ping -n 100 127.x.x.x goto :ping I have been pinging a MATES website as he does not mind as I am having trouble making it find the txt file with the iplist.At what interval do you want to ping your iplist.txt? Do you want to wait between each ping? Or ping everything in your iplist.txt, and then delay? Try this for once every minute, delay between each ping: Code: [Select]echo off :Start for /f %%a in ("C:\Documents and Settings\Matt\My Documents\Matt\iplist.txt") do ( echo %TIME% >> pingLOG ping %%a >> pingLOG ping -n 61 localhost >NUL ) goto :StartIf you are just looking for a result without the nuts & bolts then Connection Keeper will do it all for you. http://www.gammadyne.com/conkeep.htm Of course you will learn a lot more talking to these scary dos guys. Hi FELLAS! Quote would a simple way to do this be : use the "sleep" command from the [RK] uli I would swear I just posted this, but I don't see it. A bat file which can be named SLEEP.BAT and put in your path Code: [Select]echo off if x%1==x ( echo Usage: SLEEP n [where n is the number of seconds] goto Adios ) if not %1==NewCall %0 NewCall %1 >nul ping -n %2 localhost :Adios SLEEP 10 will sleep 10 seconds. Based on GuruGary's ping -n 10 localhost >nul which doesn't work on windowsNT for unknown reason Mac Cheers for the tips guys. I will give them a GO and see how it goes. We have been running a ping utility but it is a trial and my manager wanted a bacth file. Thanks again guys cheers |
|