- @echo off
- setlocal enabledelayedexpansion
- set "StrDrive="
- for /f "tokens=1* delims==" %%a in ('"wmic DiskDrive where MediaType='Fixed hard disk media' get Model,Size /value | findstr ="') do (
- if "%%a" == "Model" (
- for /f "delims=" %%i in ("%%b") do (
- set StrDrive=!StrDrive!,型号:%%i
- )
- ) else if "%%a" == "Size" (
- for /f "delims=" %%i in ("%%b") do (
- set StrDrive=!StrDrive!,容量:%%i
- )
- )
- )
- set "StrDrive=!StrDrive:~1!"
- echo,!StrDrive!
- pause
复制代码
|