本帖最后由 flashercs 于 2018-9-25 21:14 编辑
回复 14# heimahack
保存为 替换行.js 文件- (function(e){function t(e,t){WScript.Echo("[object Error]"===Object.prototype.toString.call(e)?[e.name,"source: "+(void 0===t?"":t),"number: "+(e.number>>>0).toString(16),"equipment: "+(e.number>>16&8191),"code: "+(65535&e.number),"Information: "+e.message].join("\n"):e)}var i,r,n,c=new ActiveXObject("Scripting.FileSystemObject"),o=/[^\r\n]*(\r\n|\n|\r)/g,l=0;new ActiveXObject("WScript.Shell").CurrentDirectory=c.GetParentFolderName(WScript.ScriptFullName),file=""+e.file;try{i=c.OpenTextFile(file,1,!1)}catch(e){return void t(e,"Opening file "+file)}r=i.ReadAll(),i.Close();try{i=c.OpenTextFile(file,2,!1)}catch(e){return void t(e,"Writing to file "+file)}for(;n=o.exec(r);)i.Write(void 0===e[++l]?n[0]:e[l]+n[1]);i.Close()})({file:"D:\\work\\1.txt",1001:"CHECKGAMEGOLD > 4",66:"MAXLEVEL=255"});
复制代码 功能:替换文本指定行
参数:file:“要替换的文件名” 注: 文件路径名用\\而不是\分割符
行数:"要替换的文字" 可以替换多行。 |