NB BAT批量读取图片文件属性

@echo off
setlocal enabledelayedexpansion
>tmp.vbs echo On Error Resume Next
>>tmp.vbs echo Set jFile = CreateObject("WIA.ImageFile"):jFile.LoadFile WScript.Arguments(0):WScript.Echo "W="^&jFile.Width:WScript.Echo "H="^&jFile.Height
echo 提取文件属性...if exist 文件信息.txt del 文件信息.txt
set folder=E:\mss\libcode\image
for /f "delims=""" %%i in ('dir /a-d /b /s %folder%') do (
for /f "tokens=1,2" %%j in ('dir /tc "%%i" ^| findstr "%%~nxi"') do (
set W=0&set H=0
echo.>>文件信息.txt
echo 文件名称:%%~nxi>>文件信息.txt
echo 文件大小:%%~zi字节>>文件信息.txt
echo 文件所在路径:%%~dpi>>文件信息.txt
echo 创建时间:%%j %%k>>文件信息.txt
echo 修改时间:%%~ti>>文件信息.txt
for /f "delims=" %%a in ('cscript.exe //nologo tmp.vbs "%%i"') do set "%%a"
if !W! gtr 0 echo 图片宽搜索:!W!>>文件信息.txt
if !H! gtr 0 echo 图片高:!H!>>文件信息.txt
echo.>>文件信息.txt))
start "" notepad 文件信息.txt
del tmp.vbs

posted on 2015-03-05 16:09  kelisi_king  阅读(1240)  评论(0编辑  收藏  举报