kevin
kevin

Reputation: 3

Batch Script to constantly ping, when fails use logic to disable and enable network adapters

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.

Upvotes: 0

Views: 478

Answers (1)

SachaDee
SachaDee

Reputation: 9545

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

Upvotes: 1

Related Questions