本帖最后由 WHY 于 2018-8-4 15:49 编辑
bat + js- @if(0)==(0) echo off
- dir /b /s *.txt | find /i /v "%~dp0List.txt" | cscript //nologo //e:jscript "%~f0"
- pause & goto :EOF
- @end
-
- var fso = new ActiveXObject('Scripting.FileSystemObject');
- var s = '';
- var f = fso.OpenTextFile('List.txt', 1);
-
- while(!f.AtEndOfStream){
- var strLine = f.ReadLine();
- if(strLine != '') s += '|' + strLine.replace(/[\\|+.^$*?()[{]/g, '\\$&');
- }
-
- var reg = new RegExp('^.*(' + s.substr(1) + ')', 'gm');
-
- while(!WSH.StdIn.AtEndOfStream){
- var strFile = WSH.StdIn.ReadLine();
- var str = fso.OpentextFile(strFile, 1).ReadAll().replace(reg, '¥$&');
- fso.OpenTextFile(strFile + '.Log', 2, 1).Write(str);
- }
复制代码 改一下,/-]} 这四个字符不需要转义 |