- //@echo off & setlocal enabledelayedexpansion
- //&cls & pushd c:\23\123 & dir /b *.txt|cscript -nologo -e:jscript "%~0" & pause & exit/b
- var fso,ws,f,txt,arr=[],a=[],i;
- fso=new ActiveXObject("Scripting.filesystemObject")
- ws=new ActiveXObject("Wscript.shell")
- while (!WSH.StdIn.AtEndOfStream){
- f=WSH.StdIn.Readline();
- txt=fso.OpentextFile(f,1).readall();
- arr=txt.split("");
- for(i=0;i<3;i++){
- a.push(parseInt(Math.random()*txt.length)+i);
- }
- a.sort(function(a,b){return a-b;});
- for(i=0;i<3;i++){
- arr.splice(a[i],0,f.replace(/\..+$/,""))
- }
- fso.OpentextFile(f,2).write(arr.join(""));
- }
复制代码
|