联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!
@echo off setlocal enabledelayedexpansion :Main cls set /a num2=1024*1024 for %%i 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 ( set driver=%%i set num1=0 set num3_str= set num4= for /f "tokens=3" %%j in ('dir /a /-c %%i:\ 2^>nul') do set num1=%%j if not "!num1!"=="0" ( call :loop for /f "delims=0 tokens=*" %%k in ("!num3_str!") do set num3_str=%%k if not defined num3_str ( echo.&echo %%i 盘尚未被使用,具体空间无法查询&echo. ) else ( echo.&echo %%i 盘剩余空间为 !num3_str! MB&echo. ) ) ) pause goto Main :loop :: 求商 set /a num3=%num4%%num1:~0,1%/%num2% :: 求商序列 set num3_str=%num3_str%%num3% :: 求余 set /a num4=%num4%%num1:~0,1%%%%num2% if %num4% equ 0 set num4= set num1=%num1:~1% if not "%num1%"=="" goto loop goto :eof
@echo off setlocal enabledelayedexpansion >tmp.vbs echo result = wscript.arguments(1)/1024/1024 >>tmp.vbs echo Wscript.Echo wscript.arguments(0),"盘剩余空间为",result,"MB" for %%i 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 %%i:\ ( for /f "tokens=3" %%j in ('dir /-c %%i:\') do set num=%%j if not "%%j"=="0" cscript //nologo tmp.vbs %%i: !num! )) del tmp.vbs pause exit
@echo off >tmp.vbs echo result = wscript.arguments(1)/1024/1024 >>tmp.vbs echo Wscript.Echo wscript.arguments(0),"盘剩余空间为",result,"MB" for %%i 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 %%i:\ ( for /f "tokens=3" %%j in ('dir /-c %%i:\') do set num=%%j if not "%%j"=="0" call :loop %%i: )) del tmp.vbs pause exit :loop cscript //nologo tmp.vbs %1 %num% goto :eof