IE腳本下載遠程文件到本地開啓

前提條件:javascript

  1. 添加IE信任網站 
  2. 設定IE安全性【IE插件相關選項啓用】
  3. 啓用ADODB.Stream
    • 註冊組件C:\Program Files\Common Files\System\ado\msado15.dll  
    • 修改註冊表

      [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\ActiveX Compatibility\{00000566-0000-0010-8000-00AA006D2EA4}]
      "Compatibility Flags"=dword:00000000java

實例:安全

vbscript:網站

iLocal = "本地路徑"
iRemote = "遠程http路徑"插件

set xPost = createobject("Microsoft.XMLHTTP")
xPost.Open "GET",iRemote,0
xPost.Send()
set sGet = createobject("ADODB.Stream")
sGet.Mode = 3
sGet.Type = 1
sGet.Open()
sGet.Write xPost.ResponseBody
sGet.SaveToFile iLocal,2ip

msgbox xPost.ResponseBodyrem

set oShell = CreateObject("WScript.Shell")
oShell.run iLocal
set oShell = nothingit

 

javascript:object

var filepath = "本地路徑";
var remotefile = "遠程http路徑";

var xPost = new ActiveXObject("Microsoft.XMLHTTP");
xPost.Open("GET",remotefile,false);
xPost.Send();file

var sGet = new ActiveXObject("ADODB.Stream");
sGet.Type = 1;
sGet.Open();
sGet.Write(xPost.ResponseBody);
sGet.SaveToFile(filepath,2);
sGet.Close();
sGet=null;
xPost=null;

var oShell = new ActiveXObject("WScript.Shell"); oShell.run(filepath);

相關文章
相關標籤/搜索