0

I am looking for a batch script that can constantly ping a server. When the ping fails there would be logic to stop the ping, then disable and enable network adapters.

kevin
  • 3
  • 2
  • See the answer to [this question.](http://stackoverflow.com/questions/3050898/how-to-check-if-ping-responded-or-not-in-a-batch-file) It carries out a very similar task to what you're look for. If you need clarification on anything, tag me in a comment and let me know. – CalebB Mar 31 '15 at 15:40

1 Answers1

1

Something like this :

@echo off&cls

:loop
Echo connection Test...
ping www.google.com >nul || (
  Echo Reseting the connection...
  netsh interface set interface "Name of the connection" Disable
  netsh interface set interface "Name of the connection" Enable
)
::Change the value (300) to in/decrease the time value between 2 tests
ping localhost -n 300 >nul
goto:loop
SachaDee
  • 9,245
  • 3
  • 23
  • 33