有时候做实验,需要频繁更改IP地址,掩码,网关之类的——繁琐,麻烦,效率低。于是查了下批处理命令,写个脚本,记录下,希望对大家也有点帮助。
新建一个文本文档,在里面添加:
netsh interface ip set address name="本地连接" source=static addr=你想改的IP地址 mask=相应的子网掩码 gateway=默认网关 gwmetric=auto
然后把文本文件的后缀改为bat,右键以管理员身份运行,就可以搞定了。
如果要用dhcp则输入:
netsh interface ip set address name="本地连接" source=dhcp