1.

Solve : check if CD Rom is enabled or disabled?

Answer» 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?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=

---------- snapHi,
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.
Thanks a lot guys
it helped me a lot


Discussion

No Comment Found