Question: How do you get the drive letter of the CD-ROM drive?
Answer: You can use the FINDCD program in this site's "script tools" to automatically display the CD-ROM drive letter. For example, the FINCDCD command can display the current CD-ROM drive letter and put it into the environment variable %CDROM%. In addition, I wrote a batch file that will automatically find the drive letter of the CD-ROM drive, display the result, and store it in the environment variable %CDROM%. But it requires two batch enhancement programs, Strings 2.5 and XSET 5.47, both of which can be downloaded from this site's "script tools". The contents of the file are as follows:
@echo off
set dn=66
set cdrom=
:count
strings dn=add %dn%,1
strings dr=char %dn%
xset /search "CDROM" drv drivetest %dr%
if not %drv%#==# goto ok
if %dn%#==90# goto no
goto count

k
set cdrom=%dr%
echo The CD-ROM drive letter %cdrom% has been assigned to the variable "CDROM".
goto end
:no
echo No CD-ROM found!
:end
set dr=
set dn=
set drv=
echo.
In this example, it determines the drive letter where the CD-ROM is located. If you want to determine the drive letter of some other storage device (or RAM disk, etc.), just change "CDROM" in the line "xset /search "CDROM" drv drivetest %dr%" in the file above to some other name. For example, for a RAM disk you can replace "CDROM" with "RAM".
If you have any opinions or suggestions, you can email me or leave me a message. Thanks!
A very powerful enhanced SET command, with dozens of functions. Besides powerful character operations, file operations, and other functions, it can also create windows, change colors, set passwords, and so on. It supports long filenames and DOS windows under Win3.x/9x/NT/2K/XP. It has a great many options, with full-screen help (you can use the XSET command directly for that, or read its help file). For example, XSET Dr DRIVETEST C can store the detailed status of drive C in the environment variable %DS%, including the drive type, such as HARDDISK (that is, hard disk), FLOOPY (that is, floppy disk), CDROM (that is, CD), RAM (that is, RAM disk), SUBST (that is, virtual drive), REMOTE (that is, remote drive), and so on, as well as whether it is ready, whether it is read-only, whether it is a removable disk, and other information. The latest version released this May.