下面是一言的回答, 报错- @echo off
- set disk=
- set /p disk=请输入磁盘的设备ID(例如:0):
- set partitions=
- for /f "tokens=1" %%a in ('wmic diskdrive where deviceid="%disk%" get deviceid') do (
- set partitions=%%a
- )
- if defined partitions (
- for /f "tokens=1" %%a in ('wmic partition where deviceid="%partitions%" get deviceid') do (
- set volumes=%%a
- )
- for /f "tokens=2 delims=," %%b in ('vol %volumes%') do (
- set drive_type=%%b
- )
- if /i "%drive_type%"=="MBR" (
- echo The partition form of the disk is: MBR
- ) else (
- echo The partition form of the disk is: GPT
- )
- ) else (
- echo Cannot find the specified disk.
- )
-
- pause
复制代码
|