【如果您感觉这系列文章有用,还请帮我点个赞,收个藏,让更多的人看到这篇文章】
经常要切换ip,如果通过Windows系统下的网络属性---修改Ip/网关,操作比较繁琐。
所以用bat脚本的方法比较方便:
一.创建bat脚本
1.创建文本文档.txt
2.打开文本,脚本命令写入保存
3.将txt后缀修改成bat
4.鼠标右击bat文件,以管理员身份运作,就可以成功修改ip地址了
5.后期如果要修改ip地址,右击bat文件,编辑就可以修改ip地址
二.使用dhcp自动分配ip
@echo off
netsh interface ip set address name="以太网" source=dhcp
netsh interface ip set dns name="以太网" dhcp
三.修改ip地址
@echo off
netsh interface ip set address "以太网" static 10.110.100.1 255.255.0.0 10.110.250.1
netsh interface ip add dns name = "以太网" addr = 114.114.114.114
netsh interface ip add dns name = "以太网" addr = 8.8.8.8
四.一个网络连接设置二个或多个IP地址
netsh interface ip set address name="以太网" source=static addr=192.168.1.2 mask=255.255.255.0 gateway=192.168.1.1
netsh interface ip add address name="以太网" addr=10.110.100.2 mask=255.255.255.0 gateway=10.110.100.1
netsh interface ip add address name="以太网" addr=192.168.100.2 mask=255.255.255.0