Show drive letter of DVD drive
Posted: 04 Dec 2019 19:15
I would like to find the drive letter of the DVD drive.
With this code in a batch file running in Win7
The Echo %%1 is not showing the drive
The line Set DVDDrive=%%1 is showing %1 instead of the drive letter.
How can this code be changed to show the drive letter?
With this code in a batch file running in Win7
The Echo %%1 is not showing the drive
The line Set DVDDrive=%%1 is showing %1 instead of the drive letter.
Code: Select all
setlocal
for /f "skip=1 tokens=1,2" %%i in ('wmic logicaldisk get caption^, drivetype') do (
if [%%j]==[5] echo %%i
)
endlocal
Set DVDDrive=%%1
Echo DVDDrive = %DVDDrive%