批处理脚本不断 ping,失败时使用逻辑禁用和启用网络适配器
Batch Script to constantly ping, when fails use logic to disable and enable network adapters
我正在寻找可以不断 ping 服务器的批处理脚本。当 ping 失败时,将有停止 ping 的逻辑,然后禁用和启用网络适配器。
像这样:
@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
我正在寻找可以不断 ping 服务器的批处理脚本。当 ping 失败时,将有停止 ping 的逻辑,然后禁用和启用网络适配器。
像这样:
@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