本帖最后由 CrLf 于 2015-3-18 00:30 编辑
- 1>1/* :
- @echo off
- pushd "G:\未标记\0004\002\"
- for /f "delims=" %%i in ('dir/b/s *.jpg ^| cscript -nologo -e:jscript "%~0" \d+') do (
- echo %%i
- rem 这里以输出为例,爱咋咋
- )
-
- pause & eixt /b */
-
- var re_match = new RegExp(WSH.Arguments(0)+'|.','g')
- var re_test = new RegExp(WSH.Arguments(0),'g')
-
- var text = WScript.StdIn.ReadAll().split(/[\r\n]+/)
-
- for(var i=0;i<text.length;i++){
- var match = text[i].replace(/.*[\\\/]/,'').match(re_match)
- if(match){
- for(var j=0;j<match.length;j++)
- match[j] = re_test.test(match[j])?1*match[j]:match[j]
- }
- text[i] = {string:text[i],array:match?match:[]}
- }
-
- text = text.sort(function(a,b){
- maxlength = Math.max(a.array.length,b.array.length)
- for(var i=0;i<maxlength;i++){
- if(a.array[i]<b.array[i])return -1
- if(a.array[i]>b.array[i])return 1
- }
- return a.array.length-b.array.length
- })
-
- Object.prototype.toString=function(){return this.string}
- WSH.Echo(text.join('\r\n'))
复制代码
|