w10install/scripts/remove_drive_letter.cmd
Michael H.G. Schmidt b8e94d7a1e .
2024-12-02 12:02:18 +01:00

39 lines
602 B
Batchfile

@echo off
set T=c:\TEMP
set DPARTSCRIPT=%T%\diskpart.txt
rem create temp directory ...
mkdir %T% 1>nul 2>nul
rem =====
rem MAIN
rem =====
echo Removing Drive Letter ...
echo.
> %DPARTSCRIPT% (
@echo.select disk 0
@echo.select partition 2
@echo.remove all dismount
@echo.exit
@echo.
)
diskpart /s %DPARTSCRIPT%
if %ERRORLEVEL% NEQ 0 (
echo ERROR: while removing the drive letter!
del /F %DPARTSCRIPT% 1>nul 2>nul
exit /b
)
echo Drive letter removed.
rem cleanup ...
del /F %DPARTSCRIPT% 1>nul 2>nul
echo.
echo ======
echo READY.
echo ======