Board logo

标题: [交流] 用批处理文件快速修改IP地址 [打印本页]

作者: hjb2008    时间: 2010-2-4 18:18     标题: 用批处理文件快速修改IP地址

打开记事本,输入下列信息,再保存为bat格式文件:

      @echo off
      rem eth           //
      set eth="本地连接"
      rem i            //
      set i=202.168.0.11
      rem gw            //
      set gw=202.168.0.1
      rem nm     //
      set nm=255.255.255.0
      rem dns1         //设置主DNS
      set dns1=201.74.122.12
      rem dns2         //设置辅DNS
      set dns2=201.74.122.16
      echo 本机:%i%
      netsh interface ip set address "%eth%" static %ip% %nm% %gw% default
      echo 正在添加本机主DNS:%dns1%
      netsh interface ip set dns "%eth%" static %dns1%
      echo 正在添加本机副DNS:%dns2%
      netsh interface ip add dns "%eth%" %dns2%
      echo ---------------------------------
      echo   完毕...
      echo ---------------------------------
      pause
      close
作者: cangruo    时间: 2010-2-4 18:21

感谢楼主的无私分享,我弄到自己电脑上试一下行不行,顺便问一句,所有的操作系统通用吗?
作者: ohenshuang    时间: 2010-2-4 22:33

感谢楼主提供技巧,我还是就觉得打开本地连接修改要方便一点。
作者: lmxtt    时间: 2010-2-4 22:38

这个改的是什么IP,能不能改物理IP呢?
作者: cclygg    时间: 2010-2-4 22:48

楼上的,这个是改内网IP用的,物理的IP要看你的宽带供应商了
作者: yanggun2    时间: 2010-2-4 22:52

这方法比其手设的确方便多了·收益了,还可以设置对应ip,方便更改。
作者: format12385    时间: 2010-2-5 02:43

这个适合网管设整个机房的机器用(配上变量循环),单击应用的价值不大。




欢迎光临 SiS001! Board - [第一会所 关闭注册] (http://23.225.172.100/bbs/) Powered by Discuz! 7.2