本帖最后由 zaqmlp 于 2019-12-8 20:17 编辑
- /*&cls
- @echo off
- set info=互助互利,支付宝扫码头像,感谢打赏
- rem 有问题,可加QQ956535081及时沟通
- title %info%
- cd /d "%~dp0"
- dir /a-d/b/s *.nc|cscript -nologo -e:jscript "%~f0"
- :end
- title %info%
- pause
- exit
- */
- var fso=new ActiveXObject('Scripting.FileSystemObject');
- while(!WSH.StdIn.AtEndOfStream){
- var line=WSH.StdIn.ReadLine();
- WSH.echo(line);
- var file=fso.GetFile(line);
- var f1=fso.OpenTextFile(file.Path, 1);
- var flag=true, n=1, arr=[];
- while(!f1.AtEndOfStream){
- var line=f1.ReadLine();
- if(n==1){line=line+'\r\n'+'M35T1';}
- if(line.replace(/^\s*/,'').substring(0,1)=='Z'){
- if(flag){
- flag=false;arr.push('G43H1'+line);
- }else{arr.push(line);}
- }else{arr.push(line);}
- n++;
- };
- f1.Close();
- var f1=fso.CreateTextFile(file.Path, 2);
- for(var i=0;i<arr.length;i++){
- f1.WriteLine(arr[i]);
- };
- f1.Close();
- }
- WSH.Echo('Done');
复制代码
|