【朋乐信息技术】如何快速设置IP地址,用批处理文件设置IP地址

来源:互联网 发布:2016年网络犯罪案例 编辑:程序博客网 时间:2024/04/29 02:47

【背景】

     到不同办公地点需要切换不同IP地址,每次手工修改IP还是比较麻烦,如果能通过点击一个按钮就能快速切换IP地址,这样就方便很多了;

【改善方案】

     原理:通过设置批处理文件来快速切换IP地址;

     样板:

从上图可以看到,每次我换不同地方的时候,只要点击对应的批处理文件就可以很方便的切换IP地址了;


【代码】

自动获取ip.bat对应的代码====================

netsh interface ip set address "本地连接 2" dhcp
netsh interface ip set dns "本地连接 2" dhcp

=======================================


天津海格ip.bat对应的代码====================

netsh interface ip set address name="本地连接 2" source=static addr=192.168.102.40 mask=255.255.255.0
netsh interface ip set address name="本地连接 2" gateway=192.168.102.254 gwmetric=0
netsh interface ip set dns name="本地连接 2" source=static addr=202.99.96.68 register=PRIMARY
netsh interface ip add dns "本地连接 2" 202.99.104.68

=======================================




================================================================

以上信息由广东省惠州朋乐信息技术有限公司提供,请转载时保留公司信息,谢谢!

作者:张工

公司网址:www.plee.com.cn

公司邮箱:xyu.z@plee.com.cn

QQ:2433328556

微博:http://t.qq.com/penglezhanggong

工作简介:提供企业信息化整体解决方案。

业务范围:制造业MES系统开发和实施

================================================================


0 0