本帖最后由 pcl_test 于 2015-11-2 18:35 编辑
回复 4# freesoft00 - /*&cls
- @echo off
- dir /b 151104.xml|cscript -nologo -e:jscript "%~f0"
- pause&exit/b
- */
-
- function loadText(strFileIn,strCharset){
- var stream = new ActiveXObject('ADODB.Stream');
- stream.Type = 2;
- stream.Mode = 3;
- stream.Charset = strCharset;
- stream.Open();
- stream.LoadFromFile(strFileIn);
- stream.Position = 0;
- return stream.ReadText;
- }
-
- function saveText(strArg,strFileOut,strCharset){
- var stream = new ActiveXObject('ADODB.Stream');
- stream.Mode = 3;
- stream.Type = 2;
- stream.Charset = strCharset;
- stream.Open();
- stream.WriteText(strArg);
- return stream.SaveToFile(strFileOut,2);
- }
-
- while(!WScript.StdIn.AtEndOfStream){
- var file = WScript.StdIn.ReadLine();
- var HtmlText = loadText(file,'utf-8');
- var HtmlText = HtmlText.replace(/<NODE\sNAME="SUBSECTION"[^>]+?TR="V=4622"\sEVAL="5">[\s\S]+?\n\s\s<\/NODE>/,'');
- var HtmlText = HtmlText.replace(/<NODE\sNAME="SUBSECTION"[^>]+?TR="V=4118"\sEVAL="5">[\s\S]+?\n\s\s<\/NODE>/,'');
- var HtmlText = HtmlText.replace(/<NODE\sNAME="SECTION"[^>]+?TREE_ICON="2"\sEVAL="1">[\s\S]+?\n\s<\/NODE>/,'');
- saveText(HtmlText,'./new_'+file,'utf-8');
- }
复制代码
|