Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Wait for network connection - ping

$
0
0

I have a batch file that runs at startup that attempts to connect to a server and keeps trying until the wireless network connection is available (it connects about 60 seconds after login) then launches a link to a batch file on that server.

My script works but I want to do a "for /l" and only try 10 times before failing. I can't get it to work.

@echo off

echo CONNECTING TO SERVER. PLEASE WAIT...

:start
ping -n 1 someserver >NUL
if %errorlevel%==0 goto :continue

rem wait for 15 seconds before trying again
@echo Still waiting...
ping -n 15 127.0.0.1 >NUL 2>&1

rem loopback to start
goto :start

:continue
echo ***************************
echo *Network is now available.*
echo ***************************

call "C:\Program Files\Company\Software\Launch.lnk"


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>