您的位置:首页 > 其它

IE脚本下载远程文件到本地开启

2014-04-03 16:45 225 查看
前提条件:

添加IE信任网站

设定IE安全性【IE插件相关选项启用】

启用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:00000000

实例:

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,2

msgbox xPost.ResponseBody

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

javascript:

var filepath = "本地路径";
var remotefile = "远程http路径";

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

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);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: