- @set @n=5//&set @n=5&set/p@n=字符个数:&cscript.exe -e:jscript "%~f0"&exit/b
-
- f="a.htm";
- //num=@n; //num=5;
- num=new ActiveXObject('WScript.Shell').ExpandEnvironmentStrings("%@n%");
-
- chars='ABCDEFGHIJKLMNOPQRSTUVWXYZ';
- chars+=chars.toLowerCase();
- sc=new ActiveXObject("ScriptControl");
- sc.Language="VBScript";
- sc.AddCode("function CharsGB2312() : dim high, low, s : for high=&HB0 to &HF7 : for low=&HA1 to &HFE : s = s & Chr(high*2^8 + low) : next : next : CharsGB2312 = s : end function");
- chars+=sc.Eval('CharsGB2312()');
- len=chars.length;
- function RandomChars(n){var s='';for(var i=0;i<n;i++)s+=chars.substr(parseInt(Math.random()*len),1);return s;}
- fso=new ActiveXObject('Scripting.FileSystemObject');
- s=fso.OpenTextFile(f).ReadAll();
- s=s.replace(/<\/a>/gm, function(s){return s+RandomChars(num);});
- fso.OpenTextFile('~'+f, 2, true).Write(s);
复制代码
|