Manage Windows drivers using DevCon command line tool

DevCon (devcon.exe) manages Windows drivers from an elevated Command Prompt: install the Windows Driver Kit, open its Tools folder, and run commands such as devcon find *, devcon disable or devcon update against a device's hardware ID.

This guide covers where devcon.exe lives, the commands that list, enable, disable, update, remove and rescan devices, driver package management, the PnPUtil equivalents Microsoft now recommends, and fixes for devcon failed errors.

DevCon command line tool for Windows computers

DevCon (Device Console) is a Microsoft command-line tool for driver developers and system administrators. It works only on the local computer, and any command that changes a device needs a member of the Administrators group.

  1. Install the Windows Driver Kit (WDK) from Microsoft's Download the Windows Driver Kit (WDK) page on Microsoft Learn.
  2. Open Command Prompt as administrator.
  3. Change to the DevCon folder, typically cd "C:\Program Files (x86)\Windows Kits\10\Tools\10.0.26100.0\x64" on a 64-bit PC.
  4. Run devcon find * to list every device that is currently attached.
  5. Run devcon help for the command list, or devcon help status for one command's syntax.

Microsoft now recommends PnPUtil for new work, because it ships with every Windows release and uses more reliable and secure APIs. DevCon still works for scripts and testing, and every DevCon command has a PnPUtil equivalent listed further down.

Where to get devcon.exe

DevCon is not part of Windows itself. Microsoft includes devcon.exe with the WDK, Visual Studio and the Windows SDK for desktop apps, and the WDK places it in a folder per CPU architecture.

PC type devcon.exe location in WDK 10 Example on a recent WDK
64-bit Intel or AMD (x64) %WdkDir%\10\Tools\X.Y\x64\devcon.exe C:\Program Files (x86)\Windows Kits\10\Tools\10.0.26100.0\x64\devcon.exe
32-bit (x86) %WdkDir%\10\Tools\X.Y\x86\devcon.exe Same folder with x86 in place of x64
Arm-based PC (ARM64) %WdkDir%\10\Tools\X.Y\arm64\devcon.exe Same folder with arm64 in place of x64

%WdkDir% is the folder where you installed the WDK, and X.Y is the kit version. Microsoft also publishes the DevCon source code in its Windows driver samples repository on GitHub, for developers who want to study the setup and Configuration Manager functions it calls.

How to install DevCon on Windows 11

  1. Open the Download the Windows Driver Kit (WDK) page on learn.microsoft.com.
  2. Select Download the latest WDK and run the installer from Microsoft.
  3. Finish the installation, then open File Explorer at C:\Program Files (x86)\Windows Kits\10\Tools.
  4. Open the version folder, then the folder that matches your PC: x64, x86 or arm64.
  5. Confirm devcon.exe is in that folder.
  6. Open Command Prompt as administrator and cd into that folder before you run DevCon.

Any DevCon command that changes a device fails unless you run Command Prompt as administrator first. Microsoft's Enterprise WDK (EWDK) is a self-contained ISO that also includes the WDK, if you would rather not install Visual Studio, the SDK and the WDK separately.

Manage Windows drivers using DevCon command line tool
The Windows Driver Kit installer places devcon.exe under Windows Kits\10\Tools; select Next here to install without the Visual Studio component. (Image: Microsoft)

Useful commands to manage Windows drivers using DevCon

DevCon uses the syntax devcon [/r] command [arguments]. Parameters must appear in that order; out-of-order parameters are ignored without a syntax error.

Command What it does Example
hwids Lists hardware IDs and compatible IDs devcon hwids *
find / findall Finds attached devices / also finds devices not currently attached devcon findall =net
classes / listclass Lists setup classes / lists the devices in a class devcon listclass net
status Shows whether each device's driver is running devcon status * > status.txt
driverfiles / drivernodes Lists a device's driver files / driver packages devcon driverfiles *mou*
stack / resources Shows the expected driver stack / hardware resources devcon stack =Volume
enable / disable Turns devices on or off devcon /r disable USB*
update / updateni Updates a driver from an INF, interactively or without prompts devcon update c:\windows\inf\test.inf *PNP0501
install Creates a device node and installs its driver devcon /r install c:\windows\inf\keyboard.inf *PNP030b
remove / rescan Removes a device / scans for Plug and Play hardware devcon rescan
restart / reboot Restarts a device / forces a reboot devcon restart =net @'ROOT\*MSLOOP\0000
dp_add / dp_enum / dp_delete Adds, lists and deletes third-party driver packages in the driver store devcon dp_enum
sethwid / classfilter Edits hardware IDs of root-enumerated devices / class filter drivers devcon classfilter DiskDrive upper

An ID with an asterisk is treated as a wildcard. Prefix it with a single quote, as in '*PNP0000, to match the asterisk literally. Prefix a device instance ID with @, and a setup class with =.

devcon hwids command to list hardware IDs

Most DevCon operations need a hardware ID, so start by saving a reference list of every ID on the PC.

devcon hwids * > hwids.txt

Writes the hardware IDs and compatible IDs of every device to hwids.txt. Narrow it with a pattern such as devcon hwids *floppy*, or with a class such as devcon hwids =ports.

You should see: Each device's instance ID appears with its name, hardware IDs and compatible IDs, followed by a line such as "27 matching device(s) found."

Several patterns in one command are combined with OR, so devcon hwids *pnp* *mou* returns devices matching either. A class plus patterns is combined with AND for the class, as in devcon hwids =media *pnp* *microsoft*.

Enable or disable a device with DevCon

  1. Preview what a pattern will hit with devcon status USB* or devcon hwids USB* before you change anything.
  2. Disable the matching devices with devcon /r disable USB*; the /r switch reboots only if the change needs it.
  3. To target exact devices, use their instance IDs in quotes, for example devcon /r disable "@USB\ROOT_HUB\4&2A40B465&0".
  4. Enable a device again with devcon /r enable '*PNP0000, or a whole class with devcon /r enable =Printer.
  5. Read the result line, such as "3 device(s) disabled." or "Enabled on reboot".

Disabling every USB device also cuts off a USB keyboard and mouse, so test patterns on a machine you can still reach.

Update or install a driver with DevCon

  1. Find the device's hardware ID with devcon hwids and note the INF file of the new driver.
  2. Run devcon update <full path to .inf> <hardware ID>, for example devcon update c:\windows\inf\test.inf *PNP0501.
  3. Answer the Hardware Installation prompt if the driver is unsigned, then wait for "Drivers updated successfully."
  4. For scripts, use devcon updateni instead; it skips every prompt and takes the default answer.
  5. To add a device that is not present, run devcon /r install <full path to .inf> <hardware ID>, which creates the device node and installs its driver.

updateni takes the default Stop Installation answer on an unsigned-driver warning, so an unsigned driver fails with "devcon failed." rather than installing. For everyday driver updates through Windows, update drivers in Device Manager instead.

Remove a device and rescan with DevCon

  1. Preview the match with devcon status =net *ndiswan or devcon hwids =net *ndiswan*.
  2. Remove the device with devcon /r remove =net *ndiswan*, which deletes it from the device tree along with its device stack.
  3. Run devcon rescan to scan for Plug and Play hardware so Windows picks up devices that are still present.
  4. Restart a single device without removing it with devcon restart <ID>.
  5. Force a reboot from a script with devcon reboot; it waits if open files or programs block the restart.
Remove a device with DevCon from the Plug and Play device tree diagram
devcon remove deletes a device node from this tree, and devcon rescan adds back any hardware still present. (Image: Microsoft)

Add and delete driver packages with devcon dp_add

These commands manage third-party (OEM) driver packages in the driver store. Windows renames each added INF to an oem#.inf file, and only that name works for deletion.

  1. Add a package with devcon dp_add <full path to .inf>; DevCon reports a name such as "Driver Package 'oem2.inf' added."
  2. List the third-party packages with devcon dp_enum, which shows each oem#.inf with its provider and class.
  3. Delete a package with devcon dp_delete oem2.inf; DevCon also removes its .pnf and .cat files.
  4. Read "Driver Package 'oem2.inf' deleted." as confirmation.

To check the result without a command line, view installed drivers in Windows 11 with their details.

How to download and install battery driver in Windows 11/10

There is no separate battery driver file to download for Microsoft's battery device: you uninstall the device and let Windows scan for it again, which reinstalls the driver. Battery devices and UPS devices share the Battery setup class.

  1. Plug in the laptop's charger.
  2. Select Search on the taskbar, enter device manager, and open Device Manager.
  3. Expand Batteries, right-click the battery entry (on a Surface, Microsoft Surface ACPI-Compliant Control Method Battery) and select Uninstall device.
  4. Select the computer at the top of the list, then Action > Scan for hardware changes.
  5. Restart the PC from Start > Power > Restart.
  6. With DevCon instead, run devcon find =battery, remove the battery's instance ID with devcon remove "@<instance ID>", then run devcon rescan.

If the battery still drains or will not charge after a reinstall, work through the other laptop battery fixes, and get any power-management driver from your PC maker's support site.

Install battery driver in Windows by opening Device Manager from search
Type device manager in taskbar search and open it, then expand Batteries to uninstall and rescan the battery device. (Image: Microsoft)

Advantages of using DevCon over Device Manager

Task DevCon Device Manager
Act on many devices at once Wildcards and setup classes, such as devcon /r disable USB* One device at a time
Automate in scripts Return codes 0 success, 1 requires reboot, 2 failure, 3 syntax error No script interface
Export device data Redirect output to a file, such as devcon status * > status.txt Read each properties dialog by hand
Show driver internals Driver stack, driver nodes, resources and class filters Partial, spread across property tabs
Edit class filter drivers or hardware IDs classfilter and sethwid Not available

Device Manager stays the better tool for one-off fixes on a single PC, such as when you manually install a device driver. DevCon pays off for driver testing, lab machines and repeatable scripts.

DevCon vs Device Manager: driver stack with filter, function and PDO
devcon stack shows this layering of filter and function drivers for a device, which Device Manager spreads across property tabs. (Image: Microsoft)

DevCon vs PnPUtil: equivalent commands

Microsoft describes DevCon as a code sample, never a tool to rely on, and maps each command to PnPUtil. PnPUtil is in %windir%\system32 on every Windows version since Vista, though some commands need Windows 10 version 2004 or later.

DevCon command PnPUtil equivalent
hwids pnputil /enum-devices /deviceids
find pnputil /enum-devices /connected
findall / status pnputil /enum-devices
listclass pnputil /enum-devices /class <name or GUID>
classes pnputil /enum-classes
enable / disable pnputil /enable-device / pnputil /disable-device
update / updateni pnputil /add-driver <INF name> /install
remove pnputil /remove-device
rescan pnputil /scan-devices
restart pnputil /restart-device
reboot shutdown /r /t 0
dp_add / dp_delete / dp_enum pnputil /add-driver / pnputil /delete-driver / pnputil /enum-drivers
driverfiles pnputil /enum-drivers /files

PnPUtil does not support wildcard matching. Instead, many of its commands act on every device that exactly matches a hardware or compatible ID.

devcon status command to check a device driver is running

devcon status '*PNP0000

Shows the instance ID, name and running state of the device whose hardware ID is exactly *PNP0000. Replace the ID with the one you changed, or use @ and an instance ID.

You should see: The device name followed by "Driver is running." After a disable, the status reports the device as disabled instead.

devcon failed on Windows 11

"devcon failed." is DevCon's generic error, and return code 2 means failure. The cause depends on the command you ran.

devcon failed when you enable, disable, remove or update a device

The Command Prompt is not elevated; changing a device requires the Administrators group.

  1. Close the window and open Command Prompt as administrator.
  2. cd into the DevCon folder and run the command again.

devcon updateni failed but devcon update works

The driver is unsigned, and updateni answers the warning with the default Stop Installation.

  1. Run devcon update instead and choose Continue Anyway if you trust the test driver.
  2. Use a signed driver for unattended installs.

devcon classfilter failed

The filter driver name is misspelled or the driver is not registered as a service.

  1. Check the spelling of the driver name in the command.
  2. Confirm the driver has a subkey under HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services.

devcon dp_delete failed

You used the original INF name instead of the oem#.inf name Windows assigned.

  1. Run devcon dp_enum and note the oem#.inf name.
  2. Run devcon dp_delete oem#.inf with that name.

DevCon runs but changes the wrong devices or ignores an argument

An unquoted asterisk acted as a wildcard, or the parameters were out of order and DevCon dropped them.

  1. Put a single quote before IDs that contain an asterisk, such as '*PNP0000.
  2. Quote instance IDs that contain &.
  3. Keep the order devcon [/r] command [arguments] and check it with devcon help <command>.

DevCon command line tool FAQ

How do I install devcon.exe?

Install the Windows Driver Kit from Microsoft's Download the WDK page. DevCon then sits in C:\Program Files (x86)\Windows Kits\10\Tools\<version>\x64 on 64-bit PCs. There is no separate installer; you run devcon.exe from that folder in an elevated Command Prompt.

Where do I get devcon.exe?

Microsoft ships devcon.exe with the Windows Driver Kit, Visual Studio and the Windows SDK for desktop apps. Get it from those kits on Microsoft's own download pages rather than a standalone download site, so the file is genuine.

Does DevCon work on Windows 11?

Yes. Current WDK releases include DevCon builds for x64, x86 and ARM64. Microsoft recommends PnPUtil for new projects, because it is built into Windows and uses more reliable and secure APIs.

Which devcon.exe do I use on 64-bit Windows 10?

Use the copy in the WDK's x64 folder on an Intel or AMD 64-bit PC, and the arm64 copy on an Arm-based PC. The x86 copy is for 32-bit Windows.

Is DevCon part of the Windows Driver Kit?

Yes. Microsoft lists DevCon among the WDK's driver testing tools, and the WDK installs it under %WdkDir%\10\Tools\X.Y\ in one folder per architecture.

Can DevCon manage drivers on a remote computer?

No. Microsoft documents DevCon as working on local computers only, and the reboot and restart operations are valid only on the local computer.

What do DevCon return codes mean?

DevCon returns 0 for success, 1 when a reboot is required, 2 for failure and 3 for a syntax error. Scripts can read the code to decide whether to reboot or stop.

What is the difference between devcon find and devcon findall?

devcon find lists only devices that are currently attached. devcon findall also lists devices that are installed on demand or not attached, such as a software-enumerated RAS async adapter.

Philip Celasco

Philip is a Texas-based technology writer and IT administrator at Techdows.com with more than 10 years of experience creating practical content for everyday users and professionals. He specializes in web browsers, particularly Chromium-based platforms such as Google Chrome, Microsoft Edge, Brave, and Opera. Through his work as an IT administrator, Philip has hands-on experience managing devices, configuring browser policies, troubleshooting software and network issues, and helping people resolve problems that affect productivity and security. His articles are based on practical testing and real-world technical experience. He covers browser settings, extensions, performance problems, privacy controls, security features, and Windows troubleshooting. Outside work, Philip enjoys the quieter side of life in Texas and stepping away from the screen when he can. He has two kids, two cats and loves to play golf with his mother during the weekends.

Leave a Reply

Your email address will not be published. Required fields are marked *