用批处理命令自动设置办公室局域网地址及IE代理

 

@echo off
title 自动设置代理服务器
echo 自动设置代理服务器 

echo 正在设置ip地址……
netsh interface ip set address name="本地连接" source=static addr=10.69.128.73 mask=255.255.255.0

echo 正在设置网关地址....
netsh interface ip set address name="本地连接" source=static gateway=10.69.128.1 gwmetric=1

rem echo 正在清空代理服务器设置……
rem reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f
rem reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /d "" /f
rem reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /t REG_SZ /d 0 /f
rem 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 "10.69.128.20:80" /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /t REG_SZ /d "" /f


echo 正在刷新设置……
ipconfig /flushdns

echo 设置完毕,按任意键退出!
pause

 

 

注意proxy.bupt.edu.cn:8080地址可自己修改:

@rem 运行此批处理*****
@rem【如果添加了代理就删除,反之没有代理就添加代理】*****

@echo off
title 添加/删除IE代理 &&MODE con COLS=30 LINES=3 &color 2e
setlocal ENABLEDELAYEDEXPANSION
@set uu="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
@for /f "skip=3 tokens=3" %%i in ('reg query %uu% /v ProxyEnable') do (if "%%i"=="0x0" (goto sset) else (goto ddel))

:sset
setlocal ENABLEDELAYEDEXPANSION
set uu="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
reg add %uu% /v ProxyServer /t REG_SZ /d "proxy.bupt.edu.cn:8080" /f >nul
reg add %uu% /v ProxyOverride /t REG_SZ /d "<local>" /f >nul
reg add %uu% /v ProxyEnable /t REG_DWORD /d "1" /f >nul
echo.&echo 添加了代理 &ping -n 2 127.1 >nul &&goto :eof

:ddel
setlocal ENABLEDELAYEDEXPANSION
set uu="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
reg delete %uu% /v ProxyServer /f >nul
reg delete %uu% /v ProxyOverride /f >nul
reg add %uu% /v ProxyEnable /t REG_DWORD /d "0" /f >nul
echo.&echo 代理服务器已经删除完毕! &ping -n 2 127.1 >nul &&goto :eof

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值