如何编批处理文件更改IP?

来源:百度知道 编辑:UC知道 时间:2024/06/28 12:57:39
我公司两个网段,0和1,想要来回访问很麻烦,怎么编个批处理,让我的IP可以直接转换?IP分别为:192.168.0.66和192.168.1.66,就想这两个IP来回转,可以用两个批处理文件,帮忙写出来,谢谢

@echo off
netsh interface ip set address name="本地连接" source=static addr=10.10.10.1 mask=255.255.255.0
netsh interface ip set address name="本地连接" gateway=110.10.10.2 gwmetric=0
netsh interface ip set dns name="本地连接" source=static addr=10.10.10.3 register=PRIMARY
netsh interface ip add dns name="本地连接" addr=10.10.10.4
netsh interface ip set wins name="本地连接" source=static addr=none

第二行:设置本地连接的ip地址为:10.10.10.1,子网掩码为:255.255.255.0
第三行:设置网关为110.10.10.2
第四行:设置主dns为10.10.10.3
第五行:设置备份dns为10.10.10.4
如果你只更改ip,留第二行就行了.

PS:"本地连接"你是的连接名称,你的是啥名称就改为啥,一般默认是"本地连接"..