I have a device that I often enable and disable using the Device Manager. I'd like to write a script to do this programmatically (that is, using the command line). I saw a program called devcon that works for Windows 2000, Windows XP and Windows Server 2003, but I need one that works for Windows 7. Is there one freely available?
- 12,090
- 23
- 70
- 90
- 971
- 2
- 10
- 27
3 Answers
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"
You can also create a regular shortcut, edit its properties and add the parameters in the Target field.
- 1,551
- 2
- 17
- 30
- 647
- 1
- 6
- 5
-
This worked in Vista too. – T.Todua Sep 17 '14 at 21:19
-
2It makes me both sad and happy that a tool that does this exists. – dwj Oct 03 '14 at 04:12
-
1Site does not mention supported systems but it works fine on Windows 8.1 64-bit (used the "DevManView for x64 systems" version). – Álvaro González Jan 24 '15 at 15:24
-
worked for me in 2015 april - win7-64 – Uğur Gümüşhan Apr 03 '15 at 19:49
-
It would be best if there was an option to toggle the device state. – Adil Malik Sep 24 '16 at 22:49
-
In case anyone wants to tie this to a key combo, I strongly recommend [AutoHotKey][2] for this. I'm using the following script to enable/disable my laptop's touchscreen by pressing ```Ctrl```-```Alt```-```T```: ```!^T::``` ```MsgBox, Enabling Touch in 3 seconds...``` ```Run, DevManView.exe /disable_enable "HID-compliant touch screen", C:\Program Files\DevManView``` ```return``` – Gerbus Oct 13 '18 at 20:21
-
After trying `devcon` and `pnputil`, this is the only program that allowed me to disable/enable my device without requiring a reboot! Life saver! – alelom Jan 29 '23 at 14:51
- Download the WDK Windows Driver Kit 7.1.0 from Microsoft.
- Use the Universal Extractor to extract the contents of the ISO to a temporary location... or use whatever method you like to mount and get inside the ISO.
- You can use the same tool to extract the install file "WDK\setuptools_x64fre.msi" to a temporary directory.
- In that temporary directory you will find "WinDDK\7600.16385.win7_wdk.100208-1538\tools\devcon\amd64\devcon.exe". It has been tested to work with Win7x64, and it is part of the most recent Windows Driver development kit.
So, there is Devcon.exe for Windows 7 for you. It works with Windows 7, and it is free.
Instructions taken from the Microsoft Answers forum.
- 12,950
- 1
- 25
- 36
-
This [gentleman here](http://techlikes.com/2010/09/25/devcon-problem-in-windows-7-solved.html#comment-196743312) was kind enough to upload the file by itself, so that you don't have to download a 700mb ISO just to extract it. Worked fine for me. – Hod - Monica's Army May 24 '13 at 02:11
-
1Make sure to also extract setuptools_x64fre_cab001.cab, because actually that cab file contains devcon, not the msi. – Tarnay Kálmán Jan 10 '14 at 15:38
-
https://wp.me/p7I9kP-w shows how to download only the piece of the ISO you need, shows Win 7, 8, & 10, x64 & x86. – robrich Jun 03 '18 at 20:26
For Windows 8, there is WDK 8.1 available at http://msdn.microsoft.com/en-US/windows/hardware/gg454513
The small setup binary allows to download (without installing WDK) (~500MB) and without iso-container.
Searched cabs for devcon.exe but names are scrambled. Used Universal Extractor to extract "..\Installers\Windows Driver Kit-x86_en-us.msi" - ends with an error. However, got the file I need: "...\Windows Kits\8.1\Tools\x64\devcon.exe"
Tool needs to run with Admin privs to have effect.
- 21
- 2