windows利用快速批处理方式更换IP

2011-5-9 22:48| 发布者: Arthur-K| 查看: 1633| 评论: 0

摘要:   因为家里IP跟单位IP段不一样,每天到家跟单位就要换IP,比较麻烦,于是就做了两个批处理用于快速切换IP和网关。   @echo off   rem eth //eth 为网卡名称,可在网络连接中查询,如”本地链接”   set eth=”无线网络连接”   rem ip //ip 为你想更 ...

  因为家里IP跟单位IP段不一样,每天到家跟单位就要换IP,比较麻烦,于是就做了两个批处理用于快速切换IP和网关。

  @echo off

  rem eth //eth 为网卡名称,可在网络连接中查询,如”本地链接”

  set eth=”无线网络连接”

  rem ip //ip 为你想更改的IP

  set ip=192.168.1.8

  rem gw //gw 为网关地址

  set gw=192.168.1.1

  rem netmasks //netmasks 为子网掩码

  set netmasks=255.255.255.0

  echo 正在将本机IP更改到: %ip%

  rem

  if %gw%==none netsh interface ip set address %eth% static %ip% %netmasks% %gw% > nul

  if not %gw%==none netsh interface ip set address %eth% static %ip% %netmasks% %gw% 1 > nul

  echo…………………….

  echo 检查当前本机IP:

  ipconfig

  echo…………………….

  echo 成功将本机IP更改为%ip%!

  pause

  close


路过

雷人

握手

鲜花

鸡蛋
Empty Ads
今日最多关注
    今日最多评论

      小黑屋手机版联系我们

      Copyright © 2005-2025 PCBeta. All rights reserved.

      Powered by Discuz!  CDN加速及安全服务由「快御」提供

      请勿发布违反中华人民共和国法律法规的言论,会员观点不代表远景论坛官方立场。

      远景在线 ( 苏ICP备17027154号 )|远景论坛 |Win11论坛 |Win10论坛 |Win8论坛 |Win7论坛 |WP论坛 |Office论坛

      GMT+8, 2025-4-27 11:27

      返回顶部