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);

相关文章
相关标签/搜索