I needed to disable smartcard reader on my client laptop because for some reason it had two smartcard readers and I only needed to use one so I had to disable that device on every laptop which I installed so I wanted to make it a bit easier for me.
First of all you need to download DevCon from Microsoft website.
For some really weird reason I wanted to disable all Nokia devices on my system I use:
This will disable all device which have word nokia on their id, description or so on.
When I want to enable all Nokia devices I just say:
If you know which device you want to disable/enable but you don’t know how to disable it just use
and search your device from that list. Then you need to find something which is only with that device so you won’t enable/disable wrong devices.
You can do that using find with devcon:
and you should see which device devcon see. If it only find one device then you can use that *nokia* string but if it finds more than one device then you need to find better string for devcon (example hwid if nothing else).
Because I’m lazy I do small script for everything =)
My enable script is on.bat:
and off.bat script:
So I can just say:
and all my Nokia devices will be enabled or
and all Nokia devices will be disabled :-)
When I want to know if something is enabled or disabled (when you example want to write script where you need that information you can do something like that (my ask.bat):
set x=0
devcon status "*%1*"|find /i "running" && set x=1
if %x%==0 echo Nope it's not running
if %x%==1 echo Yep it's running
Amazon.Com:
Microsoft Windows Scripting Self-Paced Learning Guide (Pro-Other)
Windows 7 and Vista Guide to Scripting, Automation, and Command Line Tools
Windows PowerShell Cookbook: The Complete Guide to Scripting Microsoft’s New Command Shell





