Rarst inspired me to take a closer look at the command line utility devcon which has been created by Microsoft. Devcon is a command line version of the Windows Device Manager.
We recently published an article about energy saving that suggested to disable computer hardware to save power. This is especially useful for mobile computer systems like laptops or netbooks.
It is possible to write a simple batch script that can turn computer hardware off. Might be a handy for users who connect their mobile computer to a power source, and use it on the road as well. They would simply turn off the unnecessary computer hardware on the road and turn it on again once it is connected to a power source again.
Other purposes that come to mind are turning of webcam or microphone, and toggling them on only when you need to make use of the devices.
The creation of these one-click options does not require programming skills but you need to know a bit about the computer hardware installed on your system. Not all hardware should be disabled, possibilities include
You need three commands to work with devcon.
Start by downloading devcon from the official Microsoft website. Unpack it to a directory of your choice. It might be a good idea to put it into a directory that is listed in the system path of the operating system, e.g. /system32.
Note: Microsoft does not offer direct downloads of devcon anymore. You need to install the WDK, Visual Sutdio or the Windows SDK for desktop apps to gain access to it. You find it under tools listed there.
Open the Windows command line with Windows-R, type cmd, and hit the Enter-key. Note that you may need to change the working directory to the directory devcon is in if it is stored under a path mentioned in environment variables.
Enter devcon find * to get a listing of all hardware devices. This can be a long list, you can use the following command to find a specific device (the command is case sensitive):
devcon find * | find "computer hardware identifier"
To find all Creative devices one could enter
devcon find * | find "Creative"
The device in the screenshot above would be the Creative Soundblaster X-FI sound card. To disable that sound card one would use the following command
devcon disable PCI\VEN_1102
It is enough to add the unique identifier for the hardware device. Here are some tips to make the most out of the find command:
Find all PCI devices
devcon find * | find "PCI"
Find all USB devices
devcon find * | find "USB"
All that needs to be done now is to collect the unique identifiers for all computer hardware devices that should be turned off at times.
Create a new text document on the computer, name it disable.bat. Right-click it, select edit and add as many devcon disable lines to it as you want.
devcon disable PCI\VEN_1102
devcon disable PCI\VEN_1317
devcon disable USB\VID_1532
Now create a second batch file, name it enable.bat and use the following code (you basically exchange disable with enable)
devcon enable PCI\VEN_1102
devcon enable PCI\VEN_1317
devcon enable USB\VID_1532
That's a basic script. You could add echo commands to it, combine the two scripts into one and improve it further. The basic script on the other hand does what it is supposed to do.
Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.
We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats or subscription fees.
If you like our content, and would like to help, please consider making a contribution:
Ghacks is a technology news blog that was founded in 2005 by Martin Brinkmann. It has since then become one of the most popular tech news sites on the Internet with five authors and regular contributions from freelance writers.