- /*&cls&echo off
- cd /d "%~dp0"
- dir /a-d-h/b/s *.txt|cscript -nologo -e:jscript "%~f0"
- pause
- exit
- */
- var fso=new ActiveXObject('Scripting.FileSystemObject');
- while(!WSH.StdIn.AtEndOfStream){
- var it=WSH.StdIn.ReadLine();
- WSH.echo(it);
- try{
- var file=fso.GetFile(it);
- var f1=fso.OpenTextFile(file.Path, 1);
- var text=f1.ReadAll();
- f1.Close();
- text=text.replace(/(\d+(?:\.\d+)?) cm/g,function(a,b){
- return (Number(b)*0.3937007874).toFixed(1).replace(/\.0$/,'')+' in';
- });
- var f2=fso.CreateTextFile(file.Path, 2);
- f2.Write(text);
- f2.Close();
- }catch(e){}
- }
复制代码
|