标题: [系统相关] 批处理diskpart怎样把list disk中的容量整合在一起? [打印本页]
作者: 风在吹着 时间: 2024-4-17 21:05 标题: 批处理diskpart怎样把list disk中的容量整合在一起?
- @echo off
-
- for %%k in (0 1 2) do (
- echo sel disk %%k > diskpart.txt
- echo detail disk >> diskpart.txt
- if %%k neq 0 (
- diskpart /s diskpart.txt>DiskInfo.txt
- )
- diskpart /s diskpart.txt>DiskInfo.txt
- for /f "tokens=3" %%a in ('type DiskInfo.txt ^| find "类型 :"') do (
- if /i "%%a" equ "NVMe" (
- echo Disk%%k Type : SSD
- ) else if /i "%%a" equ "USB" (
- echo Disk%%k Type : USB
- ) else if /i "%%a" equ "SATA" (
- echo Disk%%k Type : HDD
- )
- )
- )
- pause
复制代码
怎样把list disk中的容量整合在一起并在Disk Type那行一同显示
作者: terse 时间: 2024-4-17 23:55
按需修改下- @echo off&setlocal enabledelayedexpansion
- set "_NVMe=SSD"
- set "_USB=USB"
- set "_SATA=HDD"
- for /f "tokens=2,4,5" %%a in ('"echo list disk|diskpart|findstr /irc:"磁盘 *[0-9]""') do (
- for /f "tokens=3" %%i in ('"(echo sel disk %%a & echo detail disk & echo list part)|diskpart|findstr /irc:"类型 *:""') do (
- if defined _%%i echo Disk%%a Type: !_%%i! %%b %%c
- )
- )
- pause
复制代码
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |