本帖最后由 pcl_test 于 2016-2-11 10:33 编辑
- //&cls&dir /b "文本.txt"|cscript -nologo -e:jscript "%~f0"&pause & exit
-
- function reStr(file){
- var f = fso.opentextfile(file, 1);
- var n=3, str = f.ReadAll().replace(/兰朵/g, function($0){
- var t = $0+'_'+n;n++;return t
- });
- f.Close();
- WSH.echo(str);
- /*覆盖写入原文件
- var f = fso.opentextfile(file, 2);
- f.Write(str);
- */
- }
- var fso = new ActiveXObject('Scripting.FileSystemObject');
- while(!WScript.StdIn.AtEndOfStream)reStr(WScript.StdIn.ReadLine());
复制代码
|