本帖最后由 aloha20200628 于 2024-11-27 21:23 编辑
回复 2# ygqiang
若 wmic 真是彻底接棒给 powershell,批处就直接调用 powershell 功能了...- @echo off &setlocal enabledelayedexpansion
- for /f "tokens=1-2 delims=: " %%a in (
- 'powershell "get-physicaldisk|select *"^|findstr /ib "deviceid bustype size" '
- ) do if /i "%%a"=="size" (
- for /f %%v in ('powershell "[math]::round(%%b/1gb)" ') do echo,Disk!deviceid! !bustype! %%vGB
- ) else set "%%a=%%b"
- pause&exit/b
复制代码
|