本帖最后由 CrLf 于 2014-5-10 04:28 编辑
算了还是用 bat + js 吧,各取其长:- @if (0)==(0) echo off
- dir /ad /s /b | cscript /nologo /e:jscript %0 >a.txt
- pause&exit/b
- @end
-
- var text = WScript.StdIn.ReadAll().replace(/\r?\n/g,'\\\n').toLowerCase()
-
- var ar = text.split(/\n/).sort()
- for(var i=ar.length-1;i--;){
- if(ar[i+1].indexOf(ar[i])==0){ar.splice(i,1)}
- }
-
- text = ar.join('\r\n').replace(/\\$/gm,'')
- WScript.Echo(text)
复制代码
|