我们有一台用来测试某些设备的计算机。每隔一段时间,测试人员需要进入并卸下分配的COM端口,以便释放它们并从1开始。最近,它一直在为它们分配相同的COM端口给几个设备(大约8个设备在同一位置连接)时间),并且他们需要更改测试代码以匹配操作系统分配的任何编号。
重复的数字是报告的问题,但我每天也多次遇到“必须检查COM端口并更新代码”的问题。
在“设备管理器”中,如果打开以显示隐藏的设备,则会看到数百个!
You can tell by the size of the scrollbar the list is pretty big. I can click at each one and uninstall, but that's insane going 1 by 1 which is why I ask for a command-line alternative, so I can write a script that they can double click when they need to reset the ports.
Of course, if there's some software out there that will allow for this to happen then that's good too.
Remove active USB ports:
devcon /r remove @usb\*
Remove active LPT and COM ports:
devcon /r remove =ports
Query all COM and LPT ports:
devcon FindAll =Ports
Query active USB ports:
devcon status @usb\*
Query all USB ports - different results:
devcon findall @usb\*
devcon findall =USB
Enum all devices:
devcon hwids * > hwids.txt
Part at WDK, Windows Driver Kit Version 7.1.0.
The old version, 2003-01-29, does not work on Windows 7 (not del device). devcon old version 2003-01-29
Alternative 1 - PnPUtil
备选方案2-注册表项,在子项中搜索USB设备
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USBSTOR
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\HID
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ACPI
例子:
reg delete "HKLM\SYSTEM\CurrentControlSet\Enum\USBSTOR\Disk&Ven_Seagate&Prod_USB_2.0_Cable&Rev_0148" /f
如果端口枚举devcon FindAll =Ports
-删除此注册表项:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ACPI
如果端口枚举devcon status @usb\*
-删除此注册表项:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB
例子:
thx geermc4!我测试了devcon。在Windows驱动程序工具包版本上,它可以与Windows 7一起正常使用。
只能为Windows XP设置硬件配置文件。我们将无法在Windows 7上进行设置。这是设计使然...备份HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum
...
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句