Is there a program to enable/disable a computer's DVD-ROM drive with a mouse click?

Solution 1:

  1. See my answer here for a link to DevCon for Win7.

  2. Use devcon find *CDROM* or devcon listclass CDROM at an elevated command prompt to see a list of installed physical and virtual optical drives, for example:

    IDE\CDROMSAMSUNG_DVD-ROM_SD-608__________________2.2_____\4&13B4AFD&0&0.0.0: SAMSUNG DVD-ROM SD-608
    SCSI\CDROM&VEN_CONTOSO&PROD_VIRTUAL_DVD-ROM&REV_1.0A\1&2AFD7D61&0&0000: Contoso Virtual DVD-ROM0000
    2 matching device(s) found.
    
  3. Use the complete device ID string returned or figure out which portion(s) of the string returns only the drive you want to enable/disable. For example, a sub-string such as *CDROMSAMSUNG* or *CDROM*608* is sufficient to uniquely identify the physical drive, such that
    devcon find *CDROMSAMSUNG* returns:

    IDE\CDROMSAMSUNG_DVD-ROM_SD-608__________________2.2_____\4&13B4AFD&0&0.0.0: SAMSUNG DVD-ROM SD-608
    1 matching device(s) found.
    
  4. The rest is easy! Just use devcon disable *CDROMSAMSUNG* and
    devcon enable *CDROMSAMSUNG* to do what you want.

    Additionally, devcon status *CDROMSAMSUNG* will tell you whether "Driver is running" or "Device is disabled".


Edit: You can create ToggleCD.bat as follows:

devcon status *CDROMSAMSUNG* | find "Driver is running" && devcon disable *CDROMSAMSUNG* && goto :EOF
devcon status *CDROMSAMSUNG* | find "Device is disabled" && devcon enable *CDROMSAMSUNG* && goto :EOF

Ensure devcon.exe is in a directory that's in your PATH (for example, copy it to your Windows directory), and obviously replace *CDROMSAMSUNG* with the actual string that you identified using the instructions above.

To keep UAC on and yet bypass the prompt for the shortcut to the batch file, read the Create Administrator Mode Shortcuts Without UAC Prompts in Windows 7 or Vista article.

Solution 2:

Yes there is, you can disable DVD-drive. Go to Control Panel -> Administrative tools -> Computer management -> click on Device manager, select DVD/CD-ROM drives, right click on your drive and click "Disable". Enable it again when you want to use it :)