▼  Site Navigation Main Articles Search  ▼  Anime + Manga Anime Reviews Anime Characters Gallery Screenshots Manga Reviews  ▼  Misc News Links to Webcomics Bible Quotes About Older Musings
site version 7.3
Toggle windows hardware using devcon
written by: admin

Date Written: 7/16/12 Last Updated: 11/20/12

I have a DVD drive that does not work properly.  It seems to always think that the drive is in use if there is no disc in the drive and will not open if you push the button to open it.  What allows it to open is if I go into the device manager and manually disable and then enable the DVD drive.  It works fine until the next time I restart my computer.  

To create a desktop shortcut for the device manager right click the desktop ––> new ––> shortcut ––> add devmgmt.msc ––> next.   Alternately, I can go into the WINDOWS/system32 folder and find devmgmt.msc icon and right click the file to create a shortcut and drag the shortcut to the desktop.

The command prompt.

To shorten things further and have a shortcut that will disable and then enable the hardware in one easy stem download the microsoft utility devcon.  Double click on the file to auto unzip the file and note the location.  To use the utility start the command prompt by going to the Windows Start and then run.

Find the device ID.  To do this you can go to the device manager and find the DVD/CD–ROM Drives to find the name.  In this case the DVD hardware is named LITE–ON DVDRW LH–20A1L

In the command prompt to find the Device ID you will type the location of your devcon file and the commands you want it to execute.

The following will list all of the hardware ids used by LITE–ON DVDRW LH–20A1L:

"C:\Documents and Settings\My Name\Local Settings\Temp\i386\devcon.exe" hwids LITE*

"C:\Documents and Settings\My Name\Local Settings\Temp\i386\devcon.exe" is the location of the devcon utility.  Double quotes are used in this case to escape the spaces in the file name location.  Spaces and special characters used in file names and locations need to be escaped in order to be recognized as part of the name as opposed to a command.  

hwids is a command to find the hardware IDs.  A space is used before and after the hwids command.  

LITE* The wild card character * tells devcon to find all hardware IDs that begin with LITE.  *LITE* would cause it to locate all hardware IDs that contain LITE anywhere in the hardware name.

Several Device IDs may be listed.  Pick the first one or whatever one works and create a text file and rename it with the with the .bat extension.  Edit the file and add the following commands making sure each command is placed on separate lines:

"C:\Documents and Settings\My Name\Local Settings\Temp\i386\devcon.exe" disable IDE\CDROMLITE*
"C:\Documents and Settings\My Name\Local Settings\Temp\i386\devcon.exe" enable IDE\CDROMLITE*

Close the batch file saving the changes and you now have a batch file to disable and then enable a dvd drive.

IDE\CDROMLITE* can be replaced with the exact device ID that you found with the hwids command if you prefer.  In my case I can use the wild card character to abbreviate the commands because I only have one device with the ID IDE\CDROMLITE*

You can move the batch file to another location and then create a shortcut to the batch file.  With the shortcut you can change the image used for the shortcut.  I am pretty sure it is not possible to customize the icons of batch files.

see also:

TAGS: software, windows, software tips
copyright 2005–2023