Batch script to detect CD/DVD-rom drive
Friday, May 2nd, 2014Batch script to detect CD/DVD-rom drive
REM Check if we have a CDROM drive Setlocal EnableDelayedExpansion echo list vol > diskpart.txt diskpart /s diskpart.txt > dp_volumes.txt set hascdrom=0 FOR /F "delims=," %%v in (dp_volumes.txt) do ( rem echo %%v set str1=%%v rem echo Line is !str1! rem echo "x!str1:ROM=!" rem echo "x!str1!" if not "x!str1:ROM=!"=="x!str1!" set hascdrom=1 rem echo !hascdrom! ) if "!hascdrom!"=="0" GOTO nocdrom :cdrom echo We have a CD/DVD-rom goto :EOF :nocdrom echo No CD/DVD-rom drive available goto: EOF