批处理脚本来检查文件夹中的可用空间 [英] Batch script to check the free space on folder

查看:641
本文介绍了批处理脚本来检查文件夹中的可用空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法让在Windows的C量可用磁盘空间:使用Windows批处理文件(\\ XXX为如:C):驱动器或c \\特定的文件夹。请对此有所帮助。

Is there a way to get the amount free disk space in windows c: drive or c:\particular folder (for eg: c:\xxx)using windows batch file . Please help on this.

感谢

推荐答案

您可以使用这样的:

@ECHO OFF
COLOR a
TITLE EOFsize
FOR %%A in (A B 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:\ CALL :bytesfree %%A
ECHO.
PAUSE
GOTO :EOF

:bytesfree
FOR /f "tokens=1-3 delims= " %%A in ('dir %1: ^| find "bytes free"') do SET bytesfree="%%C"
ECHO Wscript.echo Formatnumber(eval(WScript.Arguments(0)/1073742268), 4, True,, False) > "%temp%\Calculate.vbs"
FOR /f "delims=" %%A in ('cscript //nologo "%temp%\Calculate.vbs" %bytesfree%') do set GBfree=%%A & del "%temp%\Calculate.vbs"
SET "GBFree=                %GBFRee%"
SET GBFree=%GBFRee:~-12%
ECHO %1 %GBfree% GB free
GOTO :EOF

这篇关于批处理脚本来检查文件夹中的可用空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆