回复 4# 小白龙
test-1.bat | @echo off | | | | set "MyLetter=C:" | | for /f "tokens=1-2 delims==" %%a in ('wmic LogicalDisk where "DeviceID='%MyLetter%'" assoc:value /resultclass:Win32_DiskPartition ^| findstr /b /c:"DiskIndex=" /c:"Index="') do ( | | for /f "delims=" %%i in ("%%b") do ( | | if "%%a" equ "DiskIndex" ( | | set "LD2DI=%%i" | | ) else if "%%a" equ "Index" ( | | set "LD2I=%%i" | | ) | | ) | | ) | | for /f "delims=" %%i in ('wmic Partition where "DiskIndex='%LD2DI%' and Index='%LD2I%'" get type /value ^| find "="') do ( | | echo,%%i | find "GPT" >nul | | if errorlevel 1 ( | | echo MBR | | ) else ( | | echo GPT | | ) | | ) | | pauseCOPY |
test-2.bat | @echo off | | | | set "MyLetter=C:" | | for /f "delims=" %%i in ('wmic LogicalDisk where "DeviceID='%MyLetter%'" assoc:value /resultclass:Win32_DiskPartition ^| findstr /b "Type="') do ( | | echo,%%i | find "GPT" >nul | | if errorlevel 1 ( | | echo MBR | | ) else ( | | echo GPT | | ) | | ) | | pauseCOPY |
|