本帖最后由 WHY 于 2021-1-3 14:42 编辑
如果确定是按创建时间排序,这样应该可以
Test.js- var Img = new ActiveXObject('WIA.ImageFile');
- var fso = new ActiveXObject('Scripting.FileSystemObject');
-
- Date.prototype.format = function(){
- var yy = this.getFullYear();
- var MM = ( '' + (101 + this.getMonth())).substr(1);
- var dd = ( '' + (100 + this.getDate())).substr(1);
- var hh = ( '' + (100 + this.getHours())).substr(1);
- var mm = ( '' + (100 + this.getMinutes())).substr(1);
- var ss = ( '' + (100 + this.getSeconds())).substr(1);
- return yy + MM + dd + hh + mm + ss;
- }
-
- var arr = [];
- var e = new Enumerator( fso.GetFolder('.').Files );
-
- for(;!e.atEnd();e.moveNext()){
- var file = e.item().Name;
- if( !/\.(?:jpg|bmp|png|gif)$/i.test(file) ) continue;
- Img.LoadFile(file);
- var dt = new Date(e.item().DateCreated).format();
- arr.push( dt + ' ' + file + ' ' + Img.Width + "x" + Img.Height + "x" + Img.HorizontalResolution );
- }
-
- arr.sort(); //正序
- //arr.sort().reverse(); //逆序
- fso.OpenTextFile('图片信息.txt', 2, true).WriteLine( arr.join('\r\n').replace(/^\d+ /gm, '') );
-
- WSH.Echo('Done');
复制代码 修改顶楼的:- @echo off
- set Pic=*.jpg,*.jpeg,*.png,*.bmp,*.gif
-
- call :CreatVBS
- dir /b /od /tc %Pic% | cscript //nologo "%tmp%\GetImgInfo.vbs" > PicInfo.txt
- pause & exit
-
- :CreatVBS
- (
- echo '获取图片文件的宽、高、DPI
- echo On Error Resume Next
- echo Dim Img, file
- echo Set Img = CreateObject("WIA.ImageFile"^)
- echo while Not WSH.StdIn.AtEndOfStream
- echo file = WSH.StdIn.ReadLine
- echo Img.LoadFile file
- echo WSH.Echo file ^& " " ^& Img.Width ^& "x" ^& Img.Height ^& "x" ^& Img.HorizontalResolution
- echo wend
- )>"%tmp%\GetImgInfo.vbs"
复制代码
|