How do I enable/disable a piece of hardware from Windows 7 command line. Specifically, the hardware I want to disable/enable is a SATA HDD.


  • 1
    You mean disable as in the same way you would disable from device manager? – MDMoore313 Mar 11 '13 at 14:15
  • 1
    My answer here will solve your problem perfectly. Just use devcon listclass DiskDrive instead of devcon listclass CDROM as the appropriate device class name to list all disk drives. – Karan Mar 11 '13 at 18:39

If i get this correctly you need this little tool DevCon. It acts like an alternative device manager for the command prompt. Documentation can be read here. Once you install it you will be able to enable/disable devices on your machine by their ID number.

  • Not sure if it works with Win7, will check later. From the link, "You can use DevCon with Microsoft Windows 2000, Windows XP, and Windows Server 2003. You cannot use DevCon with Windows 95, Windows 98, or Windows Millennium Edition. " – Holysmoke Mar 11 '13 at 18:23
  • Well there are fixes in case this thing won't work: bit.ly/XjzC6r And another one: bit.ly/XDHk9q – Mariyan Mar 11 '13 at 18:58
  • This command needs to run from an 'elevated command prompt'. BTW, original link works! – Holysmoke Mar 15 '13 at 17:40

"DevManView" worked way better for me (Windows 10), and it can use the name of the device, not just its ID. For some reason, I could not ID the right device using "Devcon" (it showed it in the list, but another one got affected whenever I tried Enable/Disable).

My main use is to easily disable/enable the "touch screen" device when using my pen on my table screen (so I could be able to put the palm of my hand on the table while using the pen without triggering random pointer activity).

I don't have the necessary knowledge to create a batch that would check the status of the device and "flip it" over, so I created 2 shortcuts on my taskbar (One to disable, the other for enable) using distinct icons (using devmanview /disable "HID-compliant touch screen" and devmanview /enable "HID-compliant touch screen").

"DevManView" is one of the many great free tools you can find at NirSoft.net. I've used their tools for years (almost each of them offer GUI & command line options).


A Simple Solution

If you don't have the time to mess around with devcon, here's a simpler utility:

DevManView is another way to do this - and it's a lot easier to acquire than devcon.exe, but still free.

I use the following command in a batch file to use disable/enable a device on my wife's laptop when we need it:

devmanview.exe /disable_enable "SDA Standard Compliant SD Host Controller"
  • This did not work for me, none of the devices I tried got disabled, using Windows 7 – yoda Aug 6 '15 at 3:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.