Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: check if CD Rom is enabled or disabled  (Read 2085 times)

0 Members and 1 Guest are viewing this topic.

dhariamansi

  • Guest
check if CD Rom is enabled or disabled
« on: July 19, 2006, 05:45:41 AM »
Hi...

I would like to know if there is a way in which one can through a batch file find out :
1. if the CD Rom is enabled or disabled
2. If any of the USB ports are being used and if yes what are the peripherals they are attached to?

Please can someone help me out?

uli_glueck

  • Guest
Re: check if CD Rom is enabled or disabled
« Reply #1 on: July 19, 2006, 06:47:00 AM »
Question 1:
This code checks if the driveletter in variable %CDROM% exists.
(If a CD is in the drive or not.)
I don't think it is possible to check the device with batch in the windows world.
The solution is a bit unfortunate.

hope it helps
uli

snip ----------

set CDROM=d
for %%x in (%CDROM%) do (
      if exist %%x:\NUL (echo CDROM - Drive is active %%x: ) else (echo CDROM- Drive is not active)
)
      
set CDROM=

---------- snap
« Last Edit: July 19, 2006, 06:53:15 AM by uli_glueck »

DosItHelp



    Intermediate
    Re: check if CD Rom is enabled or disabled
    « Reply #2 on: July 19, 2006, 10:23:32 PM »
    Hi,
    You can check for removable drives with fsutil fsinfo drivetype.  I.e. if the drive you want to check is D:\ then use:

    fsutil fsinfo drivetype D:\

    It might return:
    D:\ - Removable Drive
    D:\ - Fixed Drive
    D:\ - Network Drive
    D:\ - CD-ROM Drive
    D:\ - RAM Disk Drive
    or
    D:\ - No such Root Directory

    Or check all drives with a loop as described here:
    http://www.dostips.com/DtCodeSnippets.php#_Toc141112837

    USB drives would show up as "Removable Drive" I guess, just like Floppy Drives.
    All this is not exactly what you are asking for but hope it still helps you in the one or other way.
      ::)
    « Last Edit: July 19, 2006, 10:26:12 PM by DosItHelp »

    dhariamansi

    • Guest
    Re: check if CD Rom is enabled or disabled
    « Reply #3 on: July 19, 2006, 11:58:36 PM »
    Thanks a lot guys
    it helped me a lot