@ECHO OFF
REM
REM Change Current USB Drive to be on TARGETDRV Drive Letter.
REM
REM Change to root of Current Drive
CD \
F:
REM Check the current drive is removable.
FOR /F "delims=" %%x IN ('fsutil fsinfo drivetype %CD% ^| FIND /i "removable"'
DO SET DF=%%x
IF "%DF%"=="" GOTO ERROR1
echo mountvol %CD% /D > %TEMP%\mountdrv.bat
mountvol %CD% /L >%TEMP%\mountdrv.tmp
setlocal enabledelayedexpansion
SET TARGETDRV=I:
REM Check the TARGETDRV is NOT being used.
FOR /F "delims=" %%x IN ('MOUNTVOL %TARGETDRV% /L'
DO SET DF=%%x
IF NOT "%DF%"=="The system cannot find the file specified." GOTO ERROR2
set LINE=mountvol %TARGETDRV%
for /f %%a in (%TEMP%\mountdrv.tmp) do (
set LINE=!LINE!%%a
)
echo %LINE% >> %TEMP%\mountdrv.bat
del /q %TEMP%\mountdrv.tmp
endlocal
REM echo PAUSE >> %TEMP%\mountdrv.bat
type %TEMP%\mountdrv.bat
REM PAUSE
cd /d "%HOMEDRIVE%%HOMEPATH%"
%TEMP%\mountdrv.bat
goto eof
:ERROR1
ECHO Current Drive is not removable.
endlocal
goto eof
:ERROR2
ECHO %TARGETDRV% is already in use.
endlocal
goto eof
:eof
PAUSE
Copyright © 2026, NextGenUpdate.
All Rights Reserved.