网络切换命令

由于在家和在公司两个地方网络不一样,在家要设置固定IP和DNS,而在公司是自动获取IP地址和需要设置IE代理上网,在家就不需要IE代理。上网搜索了一下,整理了两个命令脚本,在公司开机后执行Company.cmd,回到家后执行Home.cmd,感觉好爽啊,不用什么工具了。我前段用了IBM的一个工具Access Connection 3.71破解版(可装于非IBM机).rar,网上有下载,虽然也不错,但还是感觉使用命令更爽。
Home.cmd
@echo off
netsh interface ip set address name="本地连接" source = static addr=192.168.0.24 mask=255.255.255.0 gateway=192.168.0.1 gwmetric=auto
rem netsh interface ip set dns name="本地连接" source=static addr=202.96.128.86 register=primary

netsh interface ip set dns 本地连接 static 202.96.128.86 primary
netsh interface ip add dns 本地连接 202.96.128.166 index=2

reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f

Company.cmd
@echo off
netsh interface ip set address name="本地连接" source=dhcp

netsh interface ip set dns name="本地连接" source=dhcp

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 "gzproxy.ip.com:8080" /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /t REG_SZ /d "localhost;10.*;*.ip.com" /f
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值