回复 14# 304802301 - @if(0)==(0) echo off
- set "folder=text"
- dir "%folder%\*.*" /b /a-d /s |cscript.exe //NoLogo //E:JScript "%~0"
- pause&exit
- @end
-
- function SaveText(filename, text, charset) {
- var stream;
- stream = new ActiveXObject("ADODB.Stream");
- stream.type = 2;
- stream.charset = charset;
- stream.open();
- stream.LoadFromFile(filename)
- stream.Position = stream.Size
- stream.writeText(text);
- stream.saveToFile(filename, 2);
- stream.close();
- }
-
- var fso = new ActiveXObject('Scripting.FileSystemObject'),
- re = /(Code="|Name="|Tender=")([^"]+)"/img,
- result = '';
- fso.CreateTextFile("result.txt", true);
- while (!WSH.StdIn.AtEndOfStream){
- var file = WSH.StdIn.ReadLine(),
- f = fso.OpenTextFile(file,1),
- content = f.ReadAll();
- f.Close();
- content.replace(re, function($a,$b,$c)
- {
- file += $c != null ? ( ' ' + $c):'';
- })
- WSH.Echo(file)
- SaveText("result.txt",file +'\n',"utf-8")
- }
复制代码
|