// Get all drives on system and loop through them System.IO.DriveInfo[] drives = System.IO.DriveInfo.GetDrives(); foreach (System.IO.DriveInfo drive in drives) { // Is this a CD drive? if (drive.DriveType == System.IO.DriveType.CDRom) Console.WriteLine(drive.Name); }
ManagementObjectCollection drives = null; using (ManagementObjectSearcher searcher = new ManagementObjectSearcher( "Select * from Win32_CDROMDrive")) { drives = searcher.Get(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)