vbs怎么下载文件?
发布网友
发布时间:2022-04-25 16:59
我来回答
共3个回答
懂视网
时间:2022-05-05 17:29
SET XACT_ABORT ON时,在事务中,若出现错误,系统即默认回滚事务, 但只对非自定义错误有效 SET XACT_ABORT OFF,默认值,在事务中,回滚一个语句还是整个事务视错误的严重程序而定,用户级错误一般不会回滚整个事务 Q: you are writing a set of queries a
SET XACT_ABORT ON时,在事务中,香港虚拟主机,若出现错误,系统即默认回滚事务,但只对非自定义错误有效
SET XACT_ABORT OFF,默认值,在事务中,回滚一个语句还是整个事务视错误的严重程序而定,美国空间,用户级错误一般不会回滚整个事务
Q:you are writing a set of queries against a filestream-enabled database. you create a stored procedure that will update multiple tables within a transaction.you need to ensure that if the stored procedure raises a run-time error,the entire transaction is terminated and rolled back.which T-SQL statement should you include at the beginning of the stored procedure?
A:SET XACT_ABORT ON
,香港服务器租用
热心网友
时间:2022-05-05 14:37
Dim obj1,obj2
Dim url
start = timer
url = "www.ddd.com/dd.pdf" '这里写你要下载文件的全路径
Set obj1 = CreateObject("msxml2.xmlhttp")
Set obj2 = CreateObject("adodb.stream")
obj1.open "get",url,False
obj1.send
temp = obj1.responseBody
obj2.Type = 1
obj2.Mode = 3
obj2.Open()
obj2.Write(temp)
obj2.SaveToFile "d:\dd.pdf",2 '这里写保存的路径和名字,后缀名要跟你文件后缀名一样哦。2的意思是已有则覆盖之
obj2.Close
endd = Timer
take = (endd-start) / 60
WScript.Echo "下载成功!" & vbCrLf & "共花费 " & take & " 秒!"
Set obj1 = Nothing
采纳吧!
热心网友
时间:2022-05-05 15:55
这个是我下http://msdn.microsoft.com/ 文档时写的一个vbs,你自己照着改吧。我这里考虑了一些出错的情况,实际的内容可远远少于这些代码,原代码来自海洋木马,至于它的从哪来的,就不知道了。
Set xaPost = CreateObject("MSXML2.ServerXMLHTTP")
Set sLog = CreateObject("ADODB.Stream")
sLog.Mode = 3
sLog.Type = 2
sLog.Open()
LogName = "log.txt"
Set sGet = CreateObject("ADODB.Stream")
sGet.Mode = 3
sGet.Type = 1
'sGet.Charset = 'utf-8'
for i=220000 to 999999
' 构建要下载的文件名
Name = i
While Len(Name) <> 6
Name = "0" & Name
Wend
Name = "aa" & Name & "(v=VS.85)"
' 发送
xaPost.Open "GET", "http://msdn.microsoft.com/zh-cn/library/" & Name & ".aspx", False
xaPost.Send()
' 根据返回的文件大小来判断文件是否存在
If UBound(xaPost.responsebody) < 9711 Or UBound(xaPost.responsebody) > 9720 then
sGet.Open()
sGet.Write(xaPost.responseBody)
sGet.SaveToFile Name & ".html", 2
sGet.Close
' 文件名不存在
Else
sLog.WriteText(Name & " ")
if sLOg.size > 5000 then
sLog.SaveToFile "log.txt", 2
sLog.position = 0
sLog.SetEos
end if
End If
Next
sLog.Close
Set sLog = Nothing
Set sGet = Nothing
Set xaPost = Nothing
msgbox "ok"