@echo off
setlocal enabledelayedexpansion
REM Set your New Drive Letter
set Ndrive1=X
set Ndrive2=Y
set Ndrive3=Z
if exist %tmp%\cdrtmp del %tmp%\cdrtmp
if exist %tmp%\cdrtmp2 del %tmp%\cdrtmp2
if exist %tmp%\romstr del %tmp%\romstr
if exist %tmp%\cdrquer del %tmp%\cdrquer
echo.list volume>%tmp%\cdrquer
diskpart /s %tmp%\cdrquer>%tmp%\cdrtmp
findstr /i "CD-ROM" %tmp%\cdrtmp>>%tmp%\romstr
findstr /i "DVD-ROM" %tmp%\cdrtmp>>%tmp%\romstr
set /a line=1
for /f "tokens=1,2,3" %%a in (%tmp%\romstr) do (
if !line!==1 (
echo.select %%a %%b>>%tmp%\cdrtmp2
echo.assign letter=%Ndrive1%>>%tmp%\cdrtmp2
)
if !line!==2 (
echo.select %%a %%b>>%tmp%\cdrtmp2
echo.assign letter=%Ndrive2%>>%tmp%\cdrtmp2
)
if !line!==3 (
echo.select %%a %%b>>%tmp%\cdrtmp2
echo.assign letter=%Ndrive3%>>%tmp%\cdrtmp2
)
set /a line=!line!+1
)
if exist %tmp%\cdrtmp2 diskpart /s %tmp%\cdrtmp2>nul
if exist %tmp%\cdrtmp del %tmp%\cdrtmp
if exist %tmp%\cdrtmp2 del %tmp%\cdrtmp2
if exist %tmp%\romstr del %tmp%\romstr
if exist %tmp%\cdrquer del %tmp%\cdrquer
|