来了……
前言:因为需要在批处理下禁用网卡和启用本地连接,所以专门找了不少这样的贴子,在网上也有不少人写出 netsh interface set interface "本地连接" "disabled"这类的语句来说可以禁用,可是事实上---------用netsh不能成功禁用网卡,至少偶试了N个小时是不成功的,幸好找到了--------devcon.exe,这个微软开发的一个小东东,虽然不是很智能,但一定程序上解决了问题,下面说说关于它的概要:
DevCon 实用工具是一种命令行实用工具,可以替代设备管理器。使用 DevCon,您可以启用、禁用、重新启动、更新、删除和查询单个设备或一组设备。DevCon 还提供与驱动程序开发人员有关、但无法在设备管理器中看到的信息。
可以将 DevCon 用于 Microsoft Windows 2000、Windows XP 和 Windows Server 2003,但不能将其用于 Windows 95、Windows 98 或 Windows Millennium Edition。
一般情况下的用法:(介绍几个常用的命令和语法)
1、devcon find
devcon find *
devcon find pci\*
2、devcon disable *msloop
3、devcon enable '*MSLOOP
真的是 一个星号,而不是通配符]
4、devcon remove @usb\*
删除所有 USB 设备。被删除的设备列出时将显示其删除状态
因为下面要讲一个实例,所以先说说硬件ID是啥玩艺,说实在的就是让大家知道怎么找出它,请看:
find pci\* 下面就是找出的一部分:
PCI\VEN_10EC&DEV_8139&SUBSYS_813910EC&REV_10\3&13C0B0C5&0&58: Realtek RTL8139 Family PCI Fast Ethernet NIC
PCI\VEN_1106&DEV_0571&SUBSYS_18271019&REV_06\3&13C0B0C5&0&89: VIA Bus Master IDE Controller
PCI\VEN_1106&DEV_3038&SUBSYS_18271019&REV_80\3&13C0B0C5&0&80: VIA Rev 5 or later USB Universal Host Controller
这几行“:”前面的就是硬件ID,后面是设备名称.
偶要禁用网卡了,请看仔细:
devcon disable *DEV_8139*
偶要启用它了,同样的搞一下: devcon enable *DEV_8139*
如果您指定 -r 并且需要重新启动,则在处理完所有设备后,将在无任何警告信息的情况下重新启动就行了,其它的就不多说了,大家喜欢用的话就去下载一个压缩包在自己机子上用用吧,有些人可能想它要是有更强大的功能,就请各位自力更生……相信自己!
压缩包里是2个文件夹,一个是32 位用的,一个是64位用的,
DevCon.exe 文件包含以下文件:
文件 说明
I386\DevCon.exe 32 位 DevCon 工具的二进制文件。此文件在 64 位 Windows 上不能充分发挥作用。
Ia64\DevCon.exe 64 位 DevCon 工具的二进制文件。
下载地址:
http://download.microsoft.com/download/1/1/f/11f7dd10-272d-4cd2-896f-9ce67f3e0240/devcon.exe
Last edited by flying008 on 2006-7-21 at 13:49 ]
Here comes……
Preface: Because I need to disable and enable the network card under batch processing, I specially found a lot of such posts. There are also many people on the Internet who write statements like netsh interface set interface "Local Area Connection" "disabled" to say that it can be disabled, but in fact---------using netsh cannot successfully disable the network card. At least I have tried for N hours and it is not successful. Fortunately, I found--------devcon.exe, this small thing developed by Microsoft. Although it is not very intelligent, it solves the problem to a certain extent. Now let's talk about the outline of it:
The DevCon utility is a command-line utility that can replace Device Manager. With DevCon, you can enable, disable, restart, update, delete, and query a single device or a group of devices. DevCon also provides information related to driver developers that cannot be seen in Device Manager.
DevCon can be used for Microsoft Windows 2000, Windows XP, and Windows Server 2003, but it cannot be used for Windows 95, Windows 98, or Windows Millennium Edition.
General usage: (Introduce several common commands and grammars)
1. devcon find
devcon find *
devcon find pci\*
2. devcon disable *msloop
3. devcon enable '*MSLOOP
is really an asterisk, not a wildcard]
4. devcon remove @usb\*
Delete all USB devices. The deleted devices will display their deletion status when listed
Because an example will be talked about below, so first talk about what the hardware ID is, to be honest, it is to let everyone know how to find it. Please see:
find pci\* The following is part of what is found:
PCI\VEN_10EC&DEV_8139&SUBSYS_813910EC&REV_10\3&13C0B0C5&0&58: Realtek RTL8139 Family PCI Fast Ethernet NIC
PCI\VEN_1106&DEV_0571&SUBSYS_18271019&REV_06\3&13C0B0C5&0&89: VIA Bus Master IDE Controller
PCI\VEN_1106&DEV_3038&SUBSYS_18271019&REV_80\3&13C0B0C5&0&80: VIA Rev 5 or later USB Universal Host Controller
The part before ":" in these lines is the hardware ID, and the part after is the device name.
I am going to disable the network card, please see carefully:
devcon disable *DEV_8139*
I am going to enable it, do the same: devcon enable *DEV_8139*
If you specify -r and need to restart, then after processing all devices, it will restart without any warning messages. Other things will not be said much. If you like to use it, go and download a compressed package to use on your own computer. Some people may think that if it has more powerful functions, please rely on yourself... Believe in yourself!
There are 2 folders in the compressed package, one for 32-bit use and one for 64-bit use,
The DevCon.exe file contains the following files:
File Description
I386\DevCon.exe Binary file of the 32-bit DevCon tool. This file does not function fully on 64-bit Windows.
Ia64\DevCon.exe Binary file of the 64-bit DevCon tool.
Download address:
http://download.microsoft.com/download/1/1/f/11f7dd10-272d-4cd2-896f-9ce67f3e0240/devcon.exe
Last edited by flying008 on 2006-7-21 at 13:49 ]