@echo off
setlocal enabledelayedexpansion
for /f "tokens=1,2 delims= " %%a in ('echo list disk ^|diskpart ^|findstr /r /c:"磁盘 "') do (
@echo select disk=%%b>%%b.script
@echo list partition>>%%b.script
@echo exit>>%%b.script
for /f "tokens=1,2 delims= " %%m in ('diskpart /s %%b.script ^|findstr /r /c:"分区 "') do (
set /a num=%%n-1
)
del %%b.script
echo 磁盘 %%b 含有 !num! 个分区
)
for %%a in (C D E F G H I J K L M N O P Q R S T U V W) do (
vol %%a: >nul 2>nul
if not errorlevel 1 (
for /f "tokens=3" %%b in ('dir /-c %%a:\^|find "可用字节"') do set freesize=%%b
set /a freesize=!freesize:~0,-3!/1049>nul
echo %%a 盘剩余空间: !freesize! MB
) else (
goto end
)
)
:end
pause
@echo off
setlocal enabledelayedexpansion
set count=0
for /f "delims=\" %%i in ('fsutil fsinfo drives^|find /v ""') do (
set var=%%i
set drive=!var:~-2!
fsutil fsinfo drivetype !drive!|find "固定">nul && set /a count=!count!+1
)
echo %count% 个固定磁盘
PAUSE
[ Last edited by fastslz on 2007-12-24 at 02:02 PM ]
@echo off
setlocal enabledelayedexpansion
set count=0
@echo off
for /f "tokens=3* delims=," %%i in ('WMIC Path Win32_LogicalDisk Get DeviceID^,Description /format:csv^|find /i "固定"') do echo %%i&set /a count=!count!+1
echo %count% 个固定磁盘
PAUSE
Originally posted by fastslz at 2007-12-24 02:11 PM:
@echo off
setlocal enabledelayedexpansion
set count=0
@echo off
for /f "tokens=3* delims=," %%i in ('WMIC Path Win32_LogicalDisk Get DeviceID^,Description /format:csv^|find /i & ...