打印

[交流] 用批处理文件快速修改IP地址

0

用批处理文件快速修改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

TOP

0
感谢楼主的无私分享,我弄到自己电脑上试一下行不行,顺便问一句,所有的操作系统通用吗?

TOP

0
感谢楼主提供技巧,我还是就觉得打开本地连接修改要方便一点。

TOP

0
这个改的是什么IP,能不能改物理IP呢?

TOP

0
楼上的,这个是改内网IP用的,物理的IP要看你的宽带供应商了

TOP

0
这方法比其手设的确方便多了·收益了,还可以设置对应ip,方便更改。

TOP

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

TOP

当前时区 GMT+8, 现在时间是 2025-3-12 15:30