if not "%~d0"=="C:" msg %username% /time:3 请在C盘上运行。 && exit
:: 设置本地系统盘符为Z盘
SETLOCAL ENABLEDELAYEDEXPANSION
for %%i in (D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%i:\Windows for /f %%b in ('mountvol %%i: /l') do set "id=%%b" && mountvol %%i: /d && mountvol Z: !id!
if not defined id msg %username% /time:3 请在VHD系统上运行。 && exit
:: 获取所有磁盘盘符ID
set n1=0
del /f /q id.txt >nul 2>nul
for %%a in (D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%a: for /f %%c in ('mountvol %%a: /l') do echo %%c >>id.txt && set /a n1=n1 +=1
:: 删除所有磁盘盘符
for %%a in (D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%a: mountvol %%a: /d
:: 重新分配磁盘盘符
set n2=0
for %%a in (D E F G H I J K L M N O P Q R S T U V W X Y Z) do if not exist %%a: for /f "delims=" %%i in (id.txt) do (
if not exist %%a: mountvol %%a: %%i && set /a n2=n2 += 1
if not "%~d0"=="C:" msg %username% /time:3 请在C盘上运行。 && exit
:: 设置本地系统盘符为Z盘
SETLOCAL ENABLEDELAYEDEXPANSION
for %%i in (D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%i:\Windows for /f %%b in ('mountvol %%i: /l') do set "id=%%b" && mountvol %%i: /d && mountvol Z: !id!
if not defined id msg %username% /time:3 请在VHD系统上运行。 && exit