回复 4# think
顶楼给的数据为啥不包含小数点?- @set @n=0;/* & echo off
- dir /ad /b | cscript -nologo -e:jscript "%~0"
- pause & exit/b & rem */
- ar = [];
- while (!WScript.StdIn.AtEndOfStream) {
- name = WScript.StdIn.ReadLine();
- s = name.replace(/\d+/g,
- function(s0){return ('0000000000'+s0).substr(s0.length)}
- )
- ar.push(s + '\\' + name);
- }
- ar.sort();
- WScript.Echo(ar.join('\r\n').replace(/.*\\/g, ''))
复制代码
D:\test>dir /ad /b
test10_1.1
test1_1.1
test1_1.10
test1_1.2
test1_10.1
test1_10.12
test1_10.2
test1_2.3
D:\test>test.bat
test1_1.1
test1_1.2
test1_1.10
test1_2.3
test1_10.1
test1_10.2
test1_10.12
test10_1.1
请按任意键继续. . . |