一、设置固定IP地址的bat文件
bat文件内容如下
------------------------------------------------------------------------------
netsh interface IP set address "本地连接" static 192.168.11.22 255.255.255.0 gateway=192.168.11.1
netsh interface IP set dns "本地连接"static addr=222.201.130.30netsh interface IP add dns "本地连接"addr=222.201.130.33
-------------------------------------------------------------------------------
运行结果如下截图:
二、动态获取IP地址
bat文件内容如下
-------------------------------------------------------------------------------
netsh interface IP set address "eduNet" source=dhcp
netsh interface IP set dns "eduNet" source=dhcp
-------------------------------------------------------------------------------
PS:window7 或者 vista的执行需要右键"以管理员身份运行"