ITeye博客

一个activeX方法 刚刚发现

抛出异常的爱 · 2010-09-14 19:14 · 技术 · Web前端 · Markdown

解答:此题 http://www.iteye.com/problems/48046 转自:http://www.blueshop.com.tw/board/show.asp?subcde=BRD20061014093911FUN&fumcde=FUM20041006152641OLG

试测过可用.


wsh=new ActiveXObject("WScript.Shell");
fso=new ActiveXObject("Scripting.FileSystemObject");
label1:
for(;;) {
tmp=Math.random()+".tmp";
//下面这句这也太难以想像了...用来代替sleep.
try{fso.CreateTextFile(tmp,false,true);break;}catch(e){continue label1;}
}
wsh.Run('cmd /c dir/w > '+tmp,0,1);
r=fso.OpenTextFile(tmp,1);
alert(tmp+'\n\n'+r.ReadAll());
r.Close();
fso.DeleteFile(tmp);

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。