本帖最后由 ygqiang 于 2024-10-29 15:51 编辑
参考下面的代码,可以显示常规容量,256G\500G | @echo off | | setlocal enabledelayedexpansion | | | | COLOR 04 | | COLOR 84 | | | | COLOR f4 | | COLOR fc | | COLOR 7c | | COLOR 74 | | echo. | | echo. | | echo --------------硬盘信息如下: | | echo. | | 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 %%i in ("%%b") do ( | | set StrDrive=!StrDrive!,品牌:%%i | | ) | | ) else if "%%a" == "Size" ( | | for /f "delims=" %%i in ("%%b") do ( | | set SizeGB=%%i | | set /a SizeGB=!SizeGB:~, -6!/1000 | | set StrDrive=!StrDrive!,容量:!SizeGB!GB | | set "StrDrive=!StrDrive:~1!" | | echo,!StrDrive! | | set "StrDrive=" | | | | ) | | ) | | ) | | | | | | pauseCOPY |
最新版本的Windows 11 专业版24h2,不内置wmic命令了? |