Day: 12/13/2008

利用批处理快速切换IP地址

【批处理设置静态IP】

********** 复制以下内容保存为bat
netsh interface ip set address name=”LAN” source = static addr = 10.16.25.23 mask=255.255.255.0
netsh interface ip set address name=”LAN” gateway = 10.16.25.253 gwmetric =1
netsh interface ip set dns name=”LAN” source = static addr = 202.96.209.5 register=PRIMARY
netsh interface ip add dns name=”LAN” addr = 61.129.109.1 index=2

注:

(1)如果你只更改ip,留第二行就行了.
(2)”本地连接”你是的网络连接名称,你的是啥名称就改为啥(如LAN),一般默认是”本地连接”..
【批处理自动获取IP】

********** 复制以下内容保存为bat
netsh interface IP set address name=”本地连接” source=dhcp
netsh interface ip set dns name=”本地连接” source=dhcp