回复 3# keshun - //&cls&@ cscript -E:javascript -Nologo "%~0" &pause&exit
- var date,line,xhr,url,values,array,file,fileName;
- d=new Date();
- fileName=line=""+d.getFullYear()+"."+(d.getMonth()+1)+"."+d.getDate();
- line+=" "+d.getHours()+":"+d.getMinutes()+":"+d.getSeconds()+" ";
- xhr=new ActiveXObject("Microsoft.XMLHTTP");
- url="https://hq.sinajs.cn/list=s_sh000001,int_dji,int_ftse";
- xhr.open("GET",url,false);
- xhr.send();
- values=xhr.responseText.match(/"(.*?(,|")){4}/g);
- for(var i=0;i<values.length;i++){
- array=values[i].substr(1,values[i].length-2).split(",");
- line+=" "+array[0]+","+array[1]+","+array[3]+"%";
- }
- WSH.Echo(line);
- file=new ActiveXObject("Scripting.FileSystemObject").CreateTextFile(fileName+".txt",true);
- file.WriteLine(line);
- file.Close();
复制代码
|