How to Manage Windows Device Drivers from the Command Prompt

In Windows, managing your hardware devices can be easily done via the Device Manager section. However, if you are in a server environment or if you want to control device drivers using the command line, then DevCon is a good alternative for the regular Device Manager.

DevCon is a part of Windows Driver Kit and is a command line utility which can be used to quickly disable, enable, install, remove, scan and list all the hardware devices in a local or network computer.

DevCon is available for free and can be downloaded from the Microsoft website. Once downloaded, extract the executable and place it somewhere in the C drive so that you can reach it easily in the command prompt. For instance, I’ve placed the extracted files in a folder named “devcon” in my C drive.

devcon-folder

Now open up the Command Prompt as the administrator. To do that, search for the command prompt in the Start menu, right click on it and select the option “Run as administrator.” If you are using Windows 8, simply select the option “Command Prompt (Admin)” from the power user menu (Win + X).

devcon-cmd-admin

Once you are in the command prompt, navigate to either the 32-bit (i386) or the 64-bit (ia64) folder in the “devcon” folder using the command below. If you have placed the DevCon executable somewhere else then change the command accordingly.

cd c:\devcon\i386

devcon-navigate-to-devcon

Now, if you want to know the syntax, different commands and arguments used by the Devcon utility, use the command below to get some help.

devcon help

devcon-help

To get a list of the devices, you can use the find command with the wild card entries. Since DevCon is also used over the network, you need to specify the computer name to get a list of the devices. You can easily find your Windows computer name in the “System Properties” window. For instance, I used the following command to get the details about my CD-ROM. Don’t forget to replace the computer name and the device name. Moreover, you can always replace the “deviceName” with the hardware IDs.

devcon.exe -m:\\computerName find deviceName

devcon-find

Alternatively, you can also use the Hardware IDs command to get a list of all the devices. To get a list of all the hardware devices, use the following command.

devcon.exe hwids *

If want to trim down the list, use the command with the wild card entries.

devcon.exe -m:\\computerName hwids deviceName*

Now to get the status of a device, use the below command. To make your life much easier, you can either use the hardware IDs or the names with wildcard entries like I did. This command outputs the device name and status of the device.

devcon.exe status deviceName

devcon-status

To disable a device using the DevCon utility, you can use the below command. Again, use the wild card entries if necessary, but be careful as you might disable other devices that you don’t intend to.

devcon.exe disable deviceName

devcon-disable

To re-enable the device, use the command below. The command does nothing more than replacing “disable” with the word “enable.”

devcon.exe enable deviceName

devcon-enable

If you want to scan for any new devices on your computer, then you can use the command below. It is just like the “Scan for new hardware” button in your Device Manager.

devcon.exe rescan

devcon-rescan

To install a certain driver using the DevCon utility, you need the INF file which comes bundled with the driver files. Now, to install a device driver, use the following command. Don’t forget to replace “Path to INF file” with the actual path and the “hardwareID” with the actual hardware ID. In case you are wondering, the switch /r is an argument to restart the computer once the process is finished.

devcon.exe /r install "path to INF file" hardwareID

To update a device driver, use the following command. While entering the hardware ID’s, you can use the wildcards, but be careful while using them.

devcon.exe /r update "path to INF file" hardwareID

Now to remove a hardware device completely, use the below command. Just like in any other command, you can use the wildcards but it is not at all recommended for this command.

devcon /r remove "hardwareID"

That’s all for now, and it is that simple to use the DevCon command-line utility to manage your hardware drivers. The commands shared above are helpful in almost all the basic situations. But if you want to know more, Microsoft Library has an excellent documentation detailing each and every command regarding the DevCon utility. So don’t forget to give it a try.

Hopefully that helps, and do comment below sharing your thoughts and experiences about using DevCon to manage your hardware drivers.