Syntax devcon.exe [-r] [-m:\\machine] command [arg...] devcon.exe help command
DevCon was originally released by Microsoft as a 'code sample', newer utilities, primarily PnPUTIL, have since been created to add new capabilities. Microsoft now recommend replacing DevCon usage with the newer utilities, listed below.
Key -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. Commands: classfilter Allow modification of class filters. classes List all device setup classes. Use PNPUTIL /enum-classes disable Disable device. Use PNPUTIL /disable-device driverfiles List driver files installed for devices. Use PNPUTIL /enum-drivers /files drivernodes List driver nodes of devices. Use PNPUTIL /enum-devices /drivers dp_add Add (install) a third-party (OEM) driver package. Use PNPUTIL /add-driver INF_Name dp_delete Delete a third-party (OEM) driver package. Use PNPUTIL /delete-driver dp_enum List the third-party (OEM) driver packages installed. Use PNPUTIL /enum-drivers enable Enable devices. Use PNPUTIL /enable-device find Find devices. Use PNPUTIL /enum-devices /connected findall Find devices including those that are not present. Use PNPUTIL /enum-devices help Display this information. hwids List hardware ID's of devices. Use PNPUTIL /enum-devices /deviceids install Manually install a device. Use PNPUTIL /add-driver INF_name /install listclass List all devices for a setup class. Use PNPUTIL /enum-devices /class Name_or_GUID reboot Reboot local machine. Use SHUTDOWN in preference to this. remove Remove devices that match the specific hardware/instance ID. Use PNPUTIL /remove-device rescan Scan for new hardware. Use PNPUTIL /scan-devices resources List hardware resources of devices. Use PNPUTIL /enum-devices /resources restart Restart devices that match the specific hardware/instance ID. Use PNPUTIL /restart-device SetHwID Add, delete, and change the order of hardware IDs of root-enumerated devices. stack List expected driver stack of devices. Use PNPUTIL /enum-devices /stack status List running status of devices. Use PNPUTIL /enum-devices update Manually update a device. Use PNPUTIL /add-driver INF_name /install UpdateNI Manually update a device without user prompt. Use PNPUTIL /add-driver INF_name /install
Wildcard matching is not supported in DevCon. As an alternative, many PnPUTIL commands offer the option to perform bulk operations on devices that exactly match a hardware or compatible ID.
Download via Windows Driver Kit or .cab download. DevCon is not redistributable. It is provided for use as a debugging and development tool i.e. not intended for production use.
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.
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.
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.
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
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 - docs.microsoft.com