DevCon Tool

[This is preliminary documentation and subject to change.]

SUMMARY

This document accompanies the "DevCon" tool which is a text-mode device console. The instructions herein apply to the Windows XP operating system. DevCon has been designed for use on Windows 2000 and Windows XP. It will not work on Windows 95, Windows 98 or Windows ME.

The "DevCon" tool described in this article is a command line utility that acts as an alternative to Device Manager. It allows individual devices or groups of devices to be enabled, disabled, restarted, updated, removed and queried. Devcon provides information that is relevant to the developer and thus not available in Device Manager.

DevCon may not be redistributed, but is available as a debugging and development tool. The source code for Devcon can be found at src\setup\devcon along with documentation and may be freely modified for private use.

USING DEVCON

Devcon can be found along with this documentation at tools\devcon. Devcon has built in help that is displayed by typing "devcon help". Examples on how to use devcon are described here.

Devcon accepts optional switches (-r for reboot, -m to specify remote machine), a command and arguments related to that command. Example DevCon commands are:

devcon find pci\*

Find and list all known PCI devices on the local machine (assuming that a device is PCI if it has a hardware ID that is prefixed by "PCI\").

devcon -m:\\foobar find pci\*

Find and list all known PCI devices on the machine "foobar" (-m allows target machine to be specified. IPC access to machine is required).

devcon classes

List all known setup classes. The output contains the short non-localized name (e.g. "USB") and the descriptive name (e.g. "Universal Serial Bus controllers").

devcon listclass usb 1394

List all present devices for each class named (in this case USB and 1394).

devcon find =ports *pnp*

List present devices that are a member of the "ports" setup class and contain "PNP" in their hardware ID.

devcon find =ports @root\*

List present devices that are a member of the "ports" setup class and live in the "root" branch of the enum tree (i.e., the instance ID is prefixed by "root\"). Note that programmatically, no assumption should be made about how an instance ID is formatted, and root devices can be determined by checking device status bits. However this feature has been provided in devcon to aid in debugging.

devcon findall =ports

Lists non-present devices along with present devices for the ports class. This will include devices that have been removed, devices that have been moved from one slot to another, or, in some cases, devices that have been enumerated differently due to a BIOS change.

devcon status @pci\*

Lists the status of each present device who's instance ID begins with "pci\".

devcon status @ACPI\PNP0501\1

Lists the status of a specific device instance, in this case an ACPI enumerated serial port.

devcon resources =ports

Lists the resources used by all devices in the ports setup class.

devcon driverfiles =ports

Lists files that are associated with each device in the ports setup class.

devcon stack =ports

Lists the expected driver stack for the device, including device and class upper/lower filters as well as the controlling service.

devcon drivernodes @ROOT\PCI_HAL\PNP0A03

Lists all compatible drivers for the device "ROOT\PCI_HAL\PNP0A03". This can be used to determine why an in-box INF was chosen in preference to a third party INF.

devcon remove @usb\*

Remove all USB devices. Devices removed will be listed along with removal status.

devcon rescan

Rescan for new Plug&Play devices.

devcon update mydev.inf *pnp0501

Update all devices that match (exactly) the hardware ID *pnp0501 to use the best driver in mydev.inf associated with the hardware ID *pnp0501. Note that this will force all devices to use the driver in mydev.inf even if there is a better match already on the system. This is useful for installing new versions of drivers during development prior to obtaining a signature. It only affects the devices that match the specified hardware ID and not child devices. If the specified INF is unsigned, Windows may display UI appear confirming that the driver should be installed. If a reboot is required, it will be reported and devcon will return with errorlevel of 1. Specifying "-r" will cause a reboot to occur automatically if one is required.

devcon -r install %windir%\inf\netloop.inf *MSLOOP

Install a new instance of the Microsoft loopback adaptor. Install will allow a "virtual device" such as the loopback adaptor to be installed by creating a new root-enumerated device node. Reboot the machine silently if a reboot is required.

devcon disable *MSLOOP

Disable all devices who's hardware ID ends with "MSLOOP" (including *MSLOOP).

devcon enable '*MSLOOP

Enable all devices who's hardware ID is "*MSLOOP". The single quote indicates that the hardware ID must be taken literally.

devcon restart =net @'ROOT\*MSLOOP\0000

Restart the loopback adaptor "ROOT\*MSLOOP\0000". The single quote indicates that the instance ID must be taken literally.

Notes

CODE TOUR

File Manifest

FileDescription
DevCon.htmSample tour documentation for this binary (this file).
ia64\DevCon.exe64-bit DevCon tool binary.
i386\DevCon.exe32-bit DevCon tool binary. This will not function completely on 64-bit Windows.

FEEDBACK

We welcome your comments, problem reports and wish-list requests. Please submit them by pointing your Internet browser to http://www.microsoft.com/ddk.

Top of page

© Microsoft Corporation 2001