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.
TIA
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.
"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).
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"
devcon listclass DiskDrive
instead ofdevcon listclass CDROM
as the appropriate device class name to list all disk drives.