无忧启动论坛

 找回密码
 注册
搜索
系统gho:最纯净好用系统下载站广告联系 微信:wuyouceo QQ:184822951
查看: 3225|回复: 3

如果修改指定的网卡的名称

[复制链接]
发表于 2012-11-21 16:38:44 | 显示全部楼层 |阅读模式
自己的的电脑里有好几个网卡,最虚拟了一个网卡它的名字还是本连接3 我想知道怎么根据Description 值来修改网卡的名称,自己的网卡信息如下:
C:\>ipconfig/all
Windows IP Configuration
        Host Name . . . . . . . . . . . . : china-6a5388968
        Primary Dns Suffix  . . . . . . . :
        Node Type . . . . . . . . . . . . : Unknown
        IP Routing Enabled. . . . . . . . : No
        WINS Proxy Enabled. . . . . . . . : No
Ethernet adapter Bluetooth 网络连接:
        Media State . . . . . . . . . . . : Media disconnected
        Description . . . . . . . . . . . : Bluetooth 设备(个人区域网)
        Physical Address. . . . . . . . . : 00-1E-4C-E9-D9-FB
Ethernet adapter 本地连接 3:
        Connection-specific DNS Suffix  . :
        Description . . . . . . . . . . . : VirtualBox Host-Only Ethernet Adapte
r
        Physical Address. . . . . . . . . : 08-00-27-00-EC-54
        Dhcp Enabled. . . . . . . . . . . : Yes
        Autoconfiguration Enabled . . . . : Yes
        Autoconfiguration IP Address. . . : 169.254.75.63
        Subnet Mask . . . . . . . . . . . : 255.255.0.0
        Default Gateway . . . . . . . . . :
Ethernet adapter 本地连接 2:
        Media State . . . . . . . . . . . : Media disconnected
        Description . . . . . . . . . . . : Broadcom NetLink (TM) Fast Ethernet
        Physical Address. . . . . . . . . : 00-1F-C6-1A-6B-E8
Ethernet adapter 无线网络连接:
        Connection-specific DNS Suffix  . :
        Description . . . . . . . . . . . : Intel(R) PRO/Wireless 3945ABG Networ
k Connection
        Physical Address. . . . . . . . . : 00-1C-BF-BF-F8-D7
        Dhcp Enabled. . . . . . . . . . . : Yes
        Autoconfiguration Enabled . . . . : Yes
        IP Address. . . . . . . . . . . . : 192.168.3.100
        Subnet Mask . . . . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . . . . : 192.168.3.1
        DHCP Server . . . . . . . . . . . : 192.168.3.1
        DNS Servers . . . . . . . . . . . : 202.100.64.68
                                            61.178.0.93
        Lease Obtained. . . . . . . . . . : 2012年11月21日星期三 16:25:53
        Lease Expires . . . . . . . . . . : 2012年11月21日星期三 18:25:53
发表于 2012-11-21 21:23:42 | 显示全部楼层
个人认为,用for读取并分析ipconfig /all的输出数据比较繁琐。以下用wmic配合netsh命令实现修改网络连接名称,Win7下测试通过(以管理者权限运行),不妨试试:

  1. @echo off
  2. set "Nic=VirtualBox Host-Only Ethernet Adapte"
  3. set "NewName=My New Nic Name"
  4. for /f "tokens=2 delims==" %%a in ('wmic nic where ^(productname^="%Nic%"^) get netconnectionID /value^|find "="') do (
  5.    set Name=%%a
  6. )
  7. netsh interface set interface name="%Name%" newname="%NewName%"
  8. pause
复制代码
回复

使用道具 举报

 楼主| 发表于 2012-11-21 21:54:31 | 显示全部楼层
谢谢我用你的方法试一下
回复

使用道具 举报

 楼主| 发表于 2012-11-21 22:04:16 | 显示全部楼层

回复 #2 pznpt 的帖子

用你的方法真的是非常的好用,比用for命令好多了
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|捐助支持|无忧启动 ( 闽ICP备05002490号-1 )

闽公网安备 35020302032614号

GMT+8, 2024-3-29 16:19

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表