今天参照一篇文章,弄了个批处理设置IP地址;
说是参照,因为我直接按照文章所给的代码设置后,没有成功;
后来参照网上其他的方法,修改了代码,终于成功了!
先来看一下文章的代码内容:
一、设置IP地址批处理,将如下代码用记事本保存为.bat文件,如:static.bat,双击运行即可。
ip地址和掩码之类的都是虚构的,根据个人具体情况具体修改。
我修改后的代码是:
@echo off
echo 修改本机IP地址工具
echo 正在设置您的IP地址为静态地址,请稍等......
netsh interface ip set address name="本地连接" source=static addr=192.168.1.102 mask=255.255.255.0 gateway=192.168.1.1 gwmetric=0
echo 设置IP地址成功。
echo 设置子网掩码成功。
echo 设置默认网关成功。
netsh interface ip set dns name="本地连接" source=static addr=41.211.224.7 register=primary
echo 设置首选DNS成功。
netsh interface ip add dns name="本地连接" addr=41.211.224.3 index=2
echo 设置备用DNS成功。
netsh interface ip set wins name="本地连接" source=static addr=none
参考文章的地址:http://blog.sina.com.cn/s/blog_4c50dcbd0100kcss.html