admin管理员组文章数量:1581581
写在前边
作用
通过BAT脚本对WIN代理服务进行开关,以达到访问外网的功能;
参考
BAT基本是搬运的,只增加了一个小细节——是否勾选“请勿将代理服务器用于本地(Intranet)地址”;
主要参考(几乎全抄):利用Win10批处理bat文件实现自动修改ip与代理设置
将要参考:dos命令行设置IE代理的实现代码
代理服务器设置
我是使用手机的V*2*R*A*Y懂的就懂,在它的“设置”中勾选“允许来自局域网的连接”,其中HTTP默认代理端口即为10809,然后在WIFI中能看到自己的IP地址,即为图中设置;两台机器在同一个局域网中,WIN机器即可通过手机代理访问外网;
代码如下
@echo off
echo ===========================================
echo 请选择要进行的操作,然后按回车
echo ===========================================
echo.
echo S.修改ip为内网ip,并设置代理
echo.
echo R.恢复ip为动态ip,并关闭代理
echo.
echo Q.退出
echo.
echo.
echo.
:loop_start
set /p choice= 请选择:
IF NOT "%choice%"=="" SET choice=%choice:~0,1%
if /i "%choice%"=="S" goto set_start
if /i "%choice%"=="R" goto reset_start
if /i "%choice%"=="Q" goto closee
echo 选择无效,请重新输入
echo.
goto loop_start
::====================================================================================
:set_start
echo 设置IP地址....
netsh interface ip set addr "以太网" static 192.168.20.107 255.255.255.0 192.168.20.1 1
echo 设置DNS地址....
netsh interface ip set dns "以太网" static 114.114.114.114 primary validate=no
echo *****设置成功!您的IP已修改为内网ip
echo.
echo 正在设置代理服务器……
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /d "192.168.60.123:10809" /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /t REG_SZ /d "localhost;127.*;10.*;172.16.*;172.17.*;172.18.*;172.19.*;172.20.*;172.21.*;172.22.*;172.23.*;172.24.*;172.25.*;172.26.*;172.27.*;172.28.*;172.29.*;172.30.*;172.31.*;172.32.*;192.168.*;<local>" /f
rem “对于本地地址不使用代理服务器”这个勾,不会勾选上
::reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /t REG_SZ /d "11.*;68.*;10.*;" /f
rem “对于本地地址不使用代理服务器”这个勾,会勾选上
::reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /t REG_SZ /d "11.*;68.*;10.*;<local>" /f
echo.
echo *****设置成功!代理服务器设置完毕
echo.
goto endd
::====================================================================================
:reset_start
echo 恢复IP地址....
netsh interface ip set addr "以太网" dhcp
echo 恢复DNS地址....
netsh interface IP set dns "以太网" dhcp
echo *****设置成功!您的IP已恢复为动态ip
echo.
echo 正在清空代理服务器设置……
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /d "" /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /t REG_SZ /d "" /f
echo.
echo *****设置成功!代理服务器设置已经清空
echo.
goto endd
::====================================================================================
:endd
pause
:closee
版权声明:本文标题:Windows设置并切换代理服务器 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dianzi/1727352830a1109871.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论