The DevCon utility is a command-line utility that acts as
an alternative to Device Manager. Using DevCon, you can enable, disable,
restart, update, remove, and query individual devices or groups of devices.
DevCon also provides information that is relevant to the driver developer and is not
available in Device Manager.
You can use DevCon with Microsoft Windows 2000, Windows XP, and Windows Server 2003. You cannot use DevCon with Windows 95, Windows 98, or
Windows Millennium Edition.
DevCon is not redistributable. It is provided for use as a
debugging and development tool. You can freely modify DevCon for private use.
The sample demonstrates how to use the SetupAPI and CfgMgr32 functions together
effectively to enumerate devices and perform device operations. The following file is available for
download from the Microsoft Download Center:
Download the DevCon package now.
Collapse this imageExpand this image
Release Date: Jan-29-2003
For more information about how to download Microsoft support files, click the following article number to view the article in the Microsoft Knowledge Base:
How to obtain Microsoft support files from online services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help prevent any unauthorized changes to the file.
The DevCon.exe file contains the following
Collapse this tableExpand this table
|I386\DevCon.exe||32-bit DevCon tool binary. This will
not function completely on 64-bit Windows.|
|Ia64\DevCon.exe||64-bit DevCon tool binary.|
The source code for DevCon is also available in the Windows DDK (which is available from
under DDK root
\Src\Setup\Devcon, along with
DevCon is a command-line utility with built-in documentation. If
you run the devcon help
command, the following list of
commands and descriptions appears. The devcon help
command will give more detailed help on any command. With some of these
commands, you can specify a remote target computer. These commands work if you
are using the 32-bit version of DevCon on WOW64.
Device Console Help:
devcon.exe [-r] [-m:\\<machine>] <command> [<arg>...]
-r if specified will reboot machine after command is complete, if needed.
<machine> is name of target machine.
<command> is command to perform (see below).
<arg>... is one or more arguments if required by command.
For help on a specific command, type: devcon.exe help <command>
classfilter Allows modification of class filters.
classes List all device setup classes.
disable Disable devices that match the specific hardware or
driverfiles List driver files installed for devices.
drivernodes Lists all the driver nodes of devices.
enable Enable devices that match the specific hardware or
find Find devices that match the specific hardware or
findall Find devices including those that are not present.
help Display this information.
hwids Lists hardware ID's of devices.
install Manually install a device.
listclass List all devices for a setup class.
reboot Reboot local machine.
remove Remove devices that match the specific hardware or
rescan Scan for new hardware.
resources Lists hardware resources of devices.
restart Restart devices that match the specific hardware or
stack Lists expected driver stack of devices.
status List running status of devices.
update Manually update a device.
UpdateNI Manually update a device without user prompt
SetHwID Adds, deletes, and changes the order of hardware IDs of root-enumerated devices.
Example DevCon commandsdevcon -m:\\test find pci\*
Lists all known PCI
devices on the computer test
, you can specify a target computer. You must use
Interprocess communication (IPC) to access the
computer.)devcon -r install %WINDIR%\Inf\Netloop.inf *MSLOOP
new instance of the Microsoft loopback adaptor. This creates a new
root-enumerated device node with which you can install a "virtual device," such
as the loopback adaptor. This command also restarts the computer silently if a
restart is required. devcon
Lists all known setup classes. The output contains
the short nonlocalized name (for example, "USB") and the descriptive name (for
example, "Universal Serial Bus controllers"). devcon
classfilter upper !filter1 !filter2
Deletes the two
specified filters.devcon classfilter lower !badfilter
Replaces the "badfilter" with the
Lists files that are associated with each device in
setup class. devcon disable
Disables all devices that have a hardware ID that
ends in "MSLOOP" (including "*MSLOOP").devcon drivernodes
Lists all compatible drivers for the
. This can be used to determine why
an integral device information (.inf) file was chosen, instead of a third-party
.inf file. devcon enable
Enables all devices that have a hardware ID of
"*MSLOOP". The single quotation mark indicates that the hardware ID must be
taken literally (in other words, the asterisk ["*"] actually is
an asterisk; it is not a wildcard character).
devcon find *
Lists device instances
of all devices that are present on the local computer.
devcon find pci\*
Lists all known
peripheral component interconnect (PCI) devices that are on the local computer
(this command assumes that a device is PCI if it has a hardware ID that is
prefixed by "PCI\").devcon find =ports
Lists devices that are present that are a member of
setup class and that contain "PNP" in their hardware ID.
devcon find =ports @root\*
devices that are present that are a member of the ports
setup class and that are in the "root" branch of the enum tree
(the instance ID is prefixed by "root\"). Note that you should not make any
programmatic assumption about how an instance ID is formatted. To determine
root devices, you can look at device status bits. This feature is included in
DevCon to aid in debugging. devcon findall
Lists "nonpresent" devices and devices that are
present for the ports
class. This includes devices that have been removed, devices that
have been moved from one slot to another, and, in some cases, devices that have
been enumerated differently due to a BIOS change. devcon
listclass usb 1394
Lists all devices that are present for
each class named (in this case, USB and 1394). devcon
Removes all USB devices. Devices that are
removed are listed with their removal status. devcon
Rescans for new Plug and Play devices.
devcon resources =ports
resources that are used by all devices in the ports
setup class. devcon restart =net
Restarts the loopback adaptor
. The single quotation mark in the command
indicates that the instance ID must be taken literally.
Lists all hardware IDs of mouse class devices on the system.devcon sethwid @ROOT\LEGACY_BEEP\0000 := beep
Assign the hardware ID, beep, to the legacy beep
device.devcon stack =ports
expected driver stack for the device. This includes device and class
upper/lower filters, and the controlling service. devcon
Lists the status of each device present that
has an instance ID that begins with "pci\". devcon status
Lists the status of a specific device
instance, in this case an Advanced Configuration and Power Interface
(ACPI)-enumerated serial port. devcon status
Lists the status of the Microsoft
Terminal Server or Terminal Services mouse driver. devcon
Lists the status of all COM ports.
devcon update mydev.inf
Updates all devices that exactly match the
hardware ID *pnp0501
to use the best driver in Mydev.inf that is associated with the
hardware ID *pnp0501
This update forces all devices to use the driver in Mydev.inf,
even if there is a better match already on the system. This is useful when you
want to install new versions of drivers during development before you obtain a
signature. The update affects only the devices that match the specified
hardware ID, and does not affect the child devices. If the specified .inf file
is unsigned, Windows may display a dialog box that prompts you to confirm
whether the driver should be installed. If a restart is required, this is
reported and DevCon returns a level 1 error. If you specify
, this causes a restart to occur automatically if one