回复 10# 5i365
如果卷标中间有空格显示会不准确
ansi编码- @echo off & cd /d "%~dp0"
- %1 start "" mshta vbscript:createobject("shell.application").shellexecute("""%~0""","REM",,"runas",1)(window.close)&exit
- setlocal enabledelayedexpansion
- set "labs=Win10|Backup"
- set "num=1"
- for /l %%i in (0,1,10) do (
- for /f "tokens=2,3,4,5,7,8" %%a in ('(echo select disk %%i ^& echo detail disk ^) ^| diskpart ^| findstr /i "%labs:|= %"') do (
- set "disk_!num!=%%i"
- set "part_!num!=%%a"
- set "letter_!num!=%%b"
- set "lab_!num!=%%c"
- set "fs_!num!=%%d"
- set "size_!num!=%%e%%f"
- set /a "num+=1"
- )
- )
- set /a "num-=1"
- for /l %%i in (1,1,%num%) do (
- echo 硬盘号: !disk_%%i! 分区号: !part_%%i! 盘符: !letter_%%i! 卷标:!lab_%%i! 类型:!fs_%%i! 大小:!size_%%i!
- )
- pause&exit
复制代码
|