文件磁盘统计_bat脚本

来源:互联网 发布:linux jenkins 安装 编辑:程序博客网 时间:2024/06/06 06:56

@echo off

for /f %%i in ('dir *.*^|find /i "个文件"') do set num=%%i

echo.

echo 文件数量统计结果:

echo.

echo D:\movie目录下有 %num% 个文件

echo.

echo.

echo D盘空间统计结果:

echo.

echo 盘符  剩余空间(字节)  分区大小(字节)

wmic logicaldisk where caption="D:" get size,freespace,caption | findstr /v /i "caption"

pause>nul

 

关于find

find  【agrs】 “string”  path

agrs: /v   未包含的行

/c  仅显示包含行数

/I  忽略大小写

/n 显示行号  

string  指定字符串

path  搜索的文件名