Turn Off Computer Hardware With A Single Click

Martin Brinkmann
May 30, 2009
Updated • Jun 21, 2017
Tutorials, Windows tips
|
9

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.

Turn Off Computer Hardware With A Single Click

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

  • Audio Devices
  • Network Adapters
  • Wireless Networking Adapters
  • CD, DVD and Blu-Ray drives
  • Floppy drives
  • webcams, card readers and other peripherals

You need three commands to work with devcon.

  • devcon find
  • devcon disable
  • devcon enable

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.

Summary
Turn Off Computer Hardware With A Single Click
Article Name
Turn Off Computer Hardware With A Single Click
Description
The guide explains how to create a simple batch file in Windows to turn specific hardware devices off with a click on the script.
Author
Publisher
Ghacks Technology News
Logo
Advertisement

Previous Post: «
Next Post: «

Comments

  1. Thomas Stein said on April 5, 2022 at 8:30 am
    Reply

    I thought this command should help me to re-initialise my monitor, as a KVM switch sometimes tells my computer to use FullHD instead of 4K when standby ends. Switching the monitor of and on always helps. So I thought I could restart the driver. “devcon status *monitor*” gives:
    DISPLAY\SAM0F35\5&C3B1AE0&0&UID772
    Name: PnP-Monitor (Standard)
    Driver is running.
    But “devcon restart DISPLAY*” only says “No matching devices found.”
    And “devcon restart *Monitor*” only answers:
    DISPLAY\SAM0F35\5&C3B1AE0&0&UID772 : Restart failed
    No matching devices found.

    What is the correct syntax?

    1. Thomas Stein said on April 5, 2022 at 9:58 am
      Reply

      I found it – that error message appears if the shell is not startet with explicit administrator rights.

  2. fr3q said on June 21, 2012 at 4:58 pm
    Reply

    Thanks a lot.It helps me because i have an audio card conflict,but it worked with 64 bit devcon that i found.

  3. Computer Rental said on July 8, 2009 at 11:59 am
    Reply

    Turning computer hardware off in just a single click can help us conserve battery power. It really doesn’t mean that it is turned off but there is a difference in the consumption of battery power. There are some steps that should be done but it is easy and can be done by anyone who are familiar to computer hardware.

  4. Rarst said on May 30, 2009 at 9:42 pm
    Reply

    @Pete

    It doesn’t really turn stuff of but there is still difference between hardware that actively does something and hardware that just sits idle.

    For example when hard drive spins down from inactivity it is not turned off by definition but it eats much less power.

    So it is not question of it having effect but question of is effect enough to bother with it. :)

  5. Pete said on May 30, 2009 at 9:37 pm
    Reply

    I really doubt this “turns off computer hardware”. Try it with optical mice, webcams, PCI network cards and optical drives and you will find that their LEDs are still on.

    This just deactivates the OS driver, sorry to burst your article’s bubble.

    Turning off peripherals and components is a motherboard/bios feature and how to do it depends on each motherboard/bios, if it supports it.

  6. Rarst said on May 30, 2009 at 6:35 pm
    Reply

    Glad you like it. :)

    I have doubts if all hardware stops consuming power if disabled. It would obviously benefit things like wireless adapters but for stuff integrated on motherboard or for PCI cards it probably won’t make a difference in power consumption.

    My opinion is saving power starts with choosing hardware, software solutions can only do as much as hardware can be bent. :)

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.