有点像南辕北辙。。
仍然借助于方便的JS(JavaScript)- @set @n=0//&cscript.exe -nologo -e:jscript "%~f0"&pause&exit/b
-
- file = "a.txt";
-
- fso = new ActiveXObject("Scripting.FileSystemObject");
- s = fso.OpenTextFile(file).ReadAll();
- result = '';
- dir = '';
- s.replace(/^Directory of (.+)|^\d+-\d+-\d+ +\d+:\d+ +\d+(?:,\d+)* (.*?comlog.*)/gim,
- function(s0,s1,s2){
- if (s1) {
- dir = s1.slice(0,-1);
- if (/comlog[^\\]*$/i.test(s1)) result += s1;
- } else result += dir+'\\'+s2;
- });
- result = result.replace(/\r/g,'\r\n').replace(/\\\\/g,'\\');
- WScript.Echo(result);
复制代码
|