我也来一个,相比楼上两位大大,我的代码好"复杂",都有点不好意思贴出来了- @echo off
- set split=5
- set zero=0000000000
- for %%a in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
- if exist %%a:\ (
- for /f "tokens=3 delims= " %%i in ('dir /-c %%a:\') do set size=%%i
- setlocal enabledelayedexpansion
- call :pd size-a size-b
- call :xyz ie1 ie2
- echo.
- call echo 你的%%a盘所剩空间为: %%ie1%%.%%ie2:~0,1%%G
- echo.
- ))
- pause&goto :eof
-
- :pd
- if "!size:~-%split%,1!"=="0" (
- set /a split-=1
- goto pd
- ) else (
- call set %1=%%size:~0,-%split%%%
- call set %2=%%size:~-%split%%%
- goto :eof
- )
-
- :xyz
- set /a a=%size-a%/1024,b=%size-b%/1024
- set /a c=%size-a%%%1024,d=%size-b%%%1024
- call set /a e=%a%%%zero:~-%split%%%
- call set /a f=%c%%%zero:~-%split%%%
- set /a %1=(%e%+%b%+(%f%+%d%)/1024)/(1024*1024)
- set /a %2=(%e%+%b%+(%f%+%d%)/1024)%%(1024*1024)
- goto :eof
复制代码
|