基于bat的自动网络重连配置脚本

前言

这个脚本的设计是本校的校园网现在在更新,然后以前挂着账号跑测试没问题,现在频繁断网,白天还行,手动登账号即可,半夜没办法,写了个脚本

参考

bat脚本实现打开关闭exe应用
windows bat无限循环的实现

代码:

 @echo off

:while
ping xxx.xxx.xxx.xxx  -n 1
if %ERRORLEVEL%==0 goto Ok
if %ERRORLEVEL%==1 goto No
:Ok
timeout /t 600 /nobreak > NUL
goto while 
:No 
start "" "C:\Program Files\Google\Chrome\Application\chrome.exe"   
:等待10秒 
ping xxx.xxx.xxx.xxx -n 10   
:杀死进程 
taskkill /f /im chrome.exe 
goto while  

思路

  1. 测试网络是否可通
  2. 通则等待10分钟再测
  3. 不通则调用谷歌浏览器(设置浏览器新标签页为校园网登录页并自动登录)
  4. 再测试网络
  5. 最后关闭浏览器

新标签页的设置

使用插件:New Tab Redirect

猜你喜欢

转载自blog.csdn.net/jack_zj123/article/details/121069077