Computer Hope

Microsoft => Microsoft DOS => Topic started by: Brian McGuigan on October 28, 2004, 05:59:26 PM

Title: Find Drive letter of CD Drive in Batch file
Post by: Brian McGuigan on October 28, 2004, 05:59:26 PM
How do I determine the drive letter of the CD drive from within a batch file?
Title: Re: Find Drive letter of CD Drive in Batch file
Post by: MalikTous on November 03, 2004, 12:32:57 AM
Most PCs with Win9x mount the CDROM as the last drive. Put a readable CD in the drive. You can test for content until you get to an error:

set %d=d:
if not exist e:\nul goto finish
set %d=e:
if not exist f:\nul goto finish
set %d=f:
if not exist g:\nul goto finish
. (continues in similar fashion, however many you want to check)
:
:finish
echo CDROM is drive %d