DEVCON.exe (Download via Windows Driver Kit or quick .cab download)

Device Manager

      devcon.exe [-r] [-m:\\machine] command [arg...]

      devcon.exe help command

   -r       Reboot the machine after command is complete, if needed.

   machine  Name of target machine.

   command  The command to perform (see below).

   arg...   One or more arguments if required by command.

  classfilter    Allow modification of class filters.
  classes        List all device setup classes.
  disable        Disable devices that match the specific hardware/instance ID.
  driverfiles    List driver files installed for devices.
  drivernodes    List all the driver nodes of devices.
  enable         Enable devices that match the specific hardware/instance ID.
  find           Find devices that match the specific hardware/instance ID.
  findall        Find devices including those that are not present.
  help           Display this information.
  hwids          List 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/instance ID.
  rescan         Scan for new hardware.
  resources      List hardware resources of devices.
  restart        Restart devices that match the specific hardware/instance ID.
  stack          List 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        Add, delete, and change the order of hardware IDs of root-enumerated devices.

DevCon is not redistributable. It is provided for use as a debugging and development tool.


List all known PCI devices on the computer pc64.

devcon -m:\\pc64 find pci\*

Install a new instance of the Microsoft loopback adaptor and restart if required. This creates a new root-enumerated device node with which you can install a "virtual device," such as the loopback adaptor.

devcon -r install %WINDIR%\Inf\Netloop.inf *MSLOOP

List all known setup classes. Displays both the short name and the descriptive name.

devcon classes

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

devcon driverfiles =ports

Disable all devices that have a hardware ID that ends in "MSLOOP" (including "*MSLOOP").

devcon disable *MSLOOP

List all compatible drivers for the device ROOT\PCI_HAL\PNP0A03. This can be used to determine why an integral device information (.inf) file was chosen, instead of a third-party .inf file.

devcon drivernodes @ROOT\PCI_HAL\PNP0A03

Enable 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 enable '*MSLOOP

List device instances of all devices that are present on the local computer.

devcon find *

List 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 pci\*

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

devcon find =ports *pnp*

List 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 find =ports @root\*

List "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 findall =ports

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

devcon listclass usb 1394

Remove all USB devices. Devices that are removed are listed with their removal status.

devcon remove @usb\*

Rescan for new Plug and Play devices.

devcon rescan

List the resources that are used by all devices in the ports setup class.

devcon resources =ports

Restart the loopback adaptor ROOT\*MSLOOP\0000. The single quotation mark in the command indicates that the instance ID must be taken literally.

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

List all hardware IDs of mouse class devices on the system.

devcon hwids=mouse

Assign the hardware ID, beep, to the legacy beep device.

devcon sethwid @ROOT\LEGACY_BEEP\0000 := beep

List the status of each device present that has an instance ID that begins with "pci\".

devcon status @pci\*

List the status of an Advanced Configuration and Power Interface (ACPI)-enumerated serial port.

devcon status @ACPI\PNP0501\1

List the status of all COM ports.

devcon status *PNP05*

Errorlevels returned by DevCon.exe:
0 = success.
1 - restart is required.
2 = failure.
3 = syntax error.

“I've learned that people will forget what you said, people will forget what you did, but people will never forget how you made them feel” ~ Maya Angelou

Related commands

DISKPART - Disk Administration.
PNPUtil.exe - Plug-and-Play Utility.
FSUTIL - File and Volume utilities.
DriverQuery Display installed device drivers.
TechNet - How to obtain the current version of Device Console utility (DevCon.exe).
DevCon -

Copyright © 1999-2023
Some rights reserved