检查网络自动重启网卡

@echo off
echo “网卡自动检查重启服务正在进行中…….”
echo “停止服务请按 Ctrl+C”

:begin
echo %date% %time% “ping……” >>ping.txt
ping 192.168.1.1 >>ping.txt
rem echo %errorlevel%
if %ERRORLEVEL% == 1 goto reboot
goto loop

:reboot
echo %date% %time% “网卡已重新启动” >>errlog.log
echo %date% %time% “网卡停用中….”
netsh interface set interface “本地连接 2” disabled
echo %date% %time% “网卡启动中….”
netsh interface set interface “本地连接 2” enabled
echo %date% %time% “网卡已重新启动….”

:loop
ping 127.0.0.1 -n 300 > nul
goto begin

#(转自CSDN)

暂无评论

发表回复

您的电子邮箱地址不会被公开。


豫ICP备17006120号-1

豫公网安备 41070202001011号