DEVCON.EXE |
This is a Microsoft tool described in Knowledge base article "311272". It is available on Windows 2000+. You may also be interested in the Device Driver Installation section of this manual (it lists other possible tools as well).
The DevCon utility is a command line utility that acts as an alternative to Device Manager. Using DevCon, you can enable, disable, restart, update, remove, and query individual devices or groups of devices. DevCon provides information that is relevant to the developer and is not available in Device Manager.
DevCon is not redistributable (this reduces a nice and useful tool to something with perhaps "some" use). I'm going to assume internal use in your company is not distribution. It is provided for use as a debugging and development tool. You can freely modify DevCon for private use. The sample demonstrates how to use the SetupAPI and CfgMgr32 functions together effectively to enumerate devices and perform device operations. Note that the source is available so you could create your own program based on this.
Example #1 - Install |
Note the use of the "^" character to "escape" the ampersand characters in the hardware ID:
devcon install etzkp.inf USB\VID_108C^&PID_0200^&MI_01 devcon install etzkq.inf USB\VID_108C^&PID_0101
Example #2 - Correct Unknown Devices |
The following demonstrates the removal of "unknown" devices ("?" in device manager) and if any were found then a hardware scan is performed:
echo off setlocal set RemoveFile=Remove.txt del "%RemoveFile%" >nul 2>&1 @REM *** Remove unknown devices, if any found need a rescan *** devcon.exe /remove =Unknown > "%RemoveFile%" type "%RemoveFile%" find.exe /I "No devices removed" "%RemoveFile%" >nul 2>&1 if errorlevel 1 devcon.exe /rescan