本帖最后由 pcl_test 于 2015-7-14 21:37 编辑
- 1>1/* :
- @echo off
- cscript -nologo -e:jscript "%~f0"
- pause & exit/b
- */
-
- //指定文件
- var f1 = "C:\\Windows\\1.log";
- var f2 = "2.txt";
- var f3 = "3.txt";
- var txt = "";
- var fso = new ActiveXObject("Scripting.FileSystemObject");
- var arr1 = fso.OpenTextFile(f2,1).ReadAll().match(/kb\d+/ig);
- var arr2 = [];
-
- for(var i = 0; i < arr1.length; i++){
- var re1 = new RegExp(arr1[i],"ig");
- if (!re1.test(arr2.join(","))){
- arr2.push(arr1[i]);
- re1.lastIndex = 0;
- }
- }
- for(var i=0;i<arr2.length;i++){
- var re2 =new RegExp("http://.*" + arr2[i] + ".*\.msu","i");
- var str = fso.OpenTextFile(f1,1).ReadAll().match(re2);
- txt+=str+"\r\n";
- }
- fso.CreateTextFile(f3,2).Write(txt);
复制代码
|