admin管理员组

文章数量:1627945

校园网一键登录脚本

复制以下内容,以bat格式保存,打开即可

mode con: cols=50 lines=20
netsh wlan connect bjfu-wifi
netsh wlan disconnect
netsh wlan connect bjfu-wifi
netsh wlan disconnect
netsh wlan connect bjfu-wifi
@echo off
echo 是否手动打开登录页面?
pause
start http://202.204.122.249
start http://login.bjfu.edu/
exit

视频演示

【北林】一键登陆校园网

校园网自动连接解决方案

电脑休眠后WiFi就会自动断开,要是是校园网,那就更加麻烦了

现在我们用bat脚本配合系统的触发器来实现WiFi的自动连接

这样,当我们打开电脑,就可以直接在浏览器打开校园网登录界面的书签登录了

注意:不能选择登录时,而要选择工作站解锁时

脚本的内容如下

netsh wlan connect bjfu-wifi

粘贴至文本文档,改后缀为bat即可

运行会自动连接目标WiFi

此外,断开网络连接的命令是

netsh wlan disconnect

如果第一次连接经常性地信号不好,可以尝试连接断开再连接这一组合操作

netsh wlan connect bjfu-wifi
netsh wlan disconnect
netsh wlan connect bjfu-wifi

甚至可以让它直接打开登录界面

netsh wlan connect bjfu-wifi
netsh wlan disconnect
netsh wlan connect bjfu-wifi
netsh wlan disconnect
netsh wlan connect bjfu-wifi
explorer http://202.204.122.249
explorer http://login.bjfu.edu/

更新1

登录窗口定时关闭

netsh wlan connect bjfu-wifi
netsh wlan disconnect
netsh wlan connect bjfu-wifi
netsh wlan disconnect
netsh wlan connect bjfu-wifi
start firefox http://202.204.122.249
start firefox http://login.bjfu.edu/
@echo off
echo 十秒后窗口将关闭
choice /t 10 /c YNC /n /d Y
taskkill /f /im firefox.exe

更新2

提供了打开登录页面的选项

netsh wlan connect bjfu-wifi
netsh wlan disconnect
netsh wlan connect bjfu-wifi
netsh wlan disconnect
netsh wlan connect bjfu-wifi
@echo off
echo 打开登录页面,请按Y
echo 退出,请按N
choice /t 2 /c YN /n /d Y
if %errorlevel%==1 goto Y
if %errorlevel%==2 goto N

:Y
start Chrome http://202.204.122.249
start Chrome http://login.bjfu.edu/
@echo off
echo 十秒后窗口将关闭
choice /t 10 /c YNC /n /d Y
taskkill /f /im chrome.exe
exit

:N
exit

更新3

设定了默认窗口大小

加入pause语句,如未弹窗,可再打开登录界面

使用Chrome的版本

mode con: cols=50 lines=20
netsh wlan connect bjfu-wifi
netsh wlan disconnect
netsh wlan connect bjfu-wifi
netsh wlan disconnect
netsh wlan connect bjfu-wifi
@echo off
echo 即将打开登录页面
pause
start Chrome http://202.204.122.249
start Chrome http://login.bjfu.edu/
echo 窗口将在十秒后关闭,请尽快登录
choice /t 10 /c YNC /n /d Y
taskkill /f /im chrome.exe
exit

默认浏览器设置为Edge的版本

mode con: cols=50 lines=20
netsh wlan connect bjfu-wifi
netsh wlan disconnect
netsh wlan connect bjfu-wifi
netsh wlan disconnect
netsh wlan connect bjfu-wifi
@echo off
echo 即将打开登录页面
pause
explorer http://202.204.122.249
explorer http://login.bjfu.edu/
::图书馆 
explorer http://202.204.122.50:8080/PortalServer/customize_new/1467775942963/pc/auth.jsp
::https://202.204.122.50:8445/PortalServer
echo 窗口将在十秒后关闭,请尽快登录
choice /t 10 /c YNC /n /d Y
taskkill /f /im MicrosoftEdge.exe
exit

本文标签: 批处理校园网一键