Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Shortcut to enable & disable device

31 Mar 2012   #1
Rogacz

Windows 7 x64
 
 
Shortcut to enable & disable device

Hi,
is there a possibility to create shortcut (hotkey or another fast method) to disable and enable device (like in device manager)?
If not for all device, is it possible for built-in cam and/or microphone?
(preferred not by 3rd party aplications)


My System SpecsSystem Spec
.
31 Mar 2012   #2
Albuquerque

Windows 7 Professional 64 EFI
 
 

There's not specifically an easy way without a bit of scripting on your part. I attempted to write you a quick VBScript that would use the WMI_SystemDriver class to enumerate all devices that contained the word "camera" in the description and then stop them.

The problem is, my Lenovo webcam doesn't allow that call; the driver exposes itself to the OS as 'unstoppable' in terms of user service control. I have a suspicion that a lot of webcams may work the same way. To get around this, you need to make a DLL call to tell the OS to disable the hardware device, which cannot be done in VBScript.

I could certainly write you such an applet, but then you'd have to simply trust me rather than being able to see what was inside - unless you have access to a C# compiler and just want the source code to compile yourself.

Another alternative that requires a lot of download time but then would allow you to use a simple DOS command to do the toggle is to grab the Windows 7 DDK from Microsoft. Part of the DDK is a utility called Devcon, which is a command-line version of WIndows device manager. A little bit of DOS wizardry with the FOR /F "usebackq..." command to parse a devcon status statement followed by another devcon enable or disable statement would allow you to toggle the hardware state and would get you where you want to be. But it's a huge download for a single stupid file, unless of course you already had use for the WinDDK.
My System SpecsSystem Spec
01 Apr 2012   #3
Rogacz

Windows 7 x64
 
 

I have Microsoft Visual Studio 2010 Ultimate (from MSDN Academic Alliance), but i don't know C# well enough to write such appet. So if you can please share your source code.

I've also try Devcon, i don't have Windows Driver Kit 7.1.0 but i found it in The DevCon command-line utility functions as an alternative to Device Manager
But i don't work well, only 32bit version starts (i have 64bit system)

Code:
C:\Users\Michał\AppData\Local\Temp\i386>devcon.exe status "USB\VID_064E&PID_F300&MI_00*"
USB\VID_064E&PID_F300&MI_00\7&30AD7D1E&0&0000
    Name: USB 2.0 UVC 0.3M Webcam
    Driver is running.
1 matching device(s) found.

C:\Users\Michał\AppData\Local\Temp\i386>devcon.exe disable "USB\VID_064E&PID_F300&MI_00*"
USB\VID_064E&PID_F300&MI_00\7&30AD7D1E&0&0000               : Disable failed
No devices disabled.
Perhaps this is an obsolete version.
My System SpecsSystem Spec
.

02 Apr 2012   #4
Albuquerque

Windows 7 Professional 64 EFI
 
 

It is an obsolete version (from 2003 if you got it from the article with the title you mentioned above.) You need the 7.1 DDK to obtain the proper version for WinVista / Win7.
My System SpecsSystem Spec
02 Apr 2012   #5
Duzzy

Windows 7 Ultimate x64
 
 

If you havn't already download the Windows Driver Kit.

Thought I had seen this Devcon file on my PC before so I did a search and found it. It's part of a couple of my drivers but it is also included with Slysoft Virtual CloneDrive. Just updated to the latest version to make sure it was still included and still worked and all is ok on Win 7 x64.

You will have to install Virtual CloneDrive though but it's free and only 1.5mb to download a lot less than the WDK. You can then uninstall it after copying the Devcon.exe to a different folder if you want.

Download here - SlySoft Virtual CloneDrive
My System SpecsSystem Spec
06 Apr 2012   #6
Rogacz

Windows 7 x64
 
 

Thank both of you, it works great
My System SpecsSystem Spec
Reply

 Shortcut to enable & disable device




Thread Tools




Similar help and support threads
Thread Forum
shortcut to enable or disable device in device manager
hi i would like to know i would like to enable or disable a device from device manager without opening device manger is there maybe a script or a shortcut
Hardware & Devices
Keyboard shortcut for disable\enable 2nd screen?
Hey. I'm using a dual monitor (you can see the configuration on the #1 attached image.) I'm not always using the second (not main screen) screen and I wonder if there is a keyboard shortcut to disable (set mode as seen at #2 attached image) or re-enable (as seen at #1 attached image) the 2th ...
Graphic Cards
How to create shortcut for Windows Firewall rule (enable/disable)?
Hello, hopefully this is right subforum to start this thread :) I've googled on how to quickly and easily enable/disable single Windows Firewall rule without having to open the firewall, going into advanced options, and eventually manually finding my rule there. Best I've found was two...
System Security
Shortcut or Hotkey to quickly disable or enable folder options
anyway to do this? shortcut, hotkey? http://i1263.photobucket.com/albums/ii636/TheDarkAvenger85/Forums/folder_options.png
General Discussion
Device Manager MMC Snap-in - Enable or Disable
How to Enable or Disable the Device Manager MMC Snap-in This will show you how to enable or disable all users on the computer from being able to open and view the Device Manager MMC snap-in window in Vista, Windows 7, and Windows 8. You will need to be logged in as an administrator to be...
Tutorials
How can I make shortcut for enable/disable touchpad?
Hello I have a HP 6735s and he has no special key for enabeling/disabeling touchpad. I tried every combination with Function key and its not any of them. Is it any way to make something that turns it off and back on when i want with combination of some keys? Help please..... Thanks
General Discussion


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 19:28.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App