0

我的 VBScript 如下:

Dim myURL 
Dim password
Dim username 
myURL = "https://webdav.pcloud.com/Public%20Folder/d.txt" ' change your URL here...
username = "xyz@gmail.com"
password = "xyzpassword"

Dim HttpReq 
Set HttpReq = CreateObject("Microsoft.XMLHTTP")
HttpReq.Open "GET", myURL, False, "username", "password"
HttpReq.send
myURL = HttpReq.responseBody
If HttpReq.Status = 200 Then
    Set oStrm = CreateObject("ADODB.Stream")
    oStrm.Open
    oStrm.Type = 1
    oStrm.Write HttpReq.responseBody
    oStrm.SaveToFile "C:\d.txt", 2 ' change your path here...
    oStrm.Close
End If

当我运行它时没有检测到错误,但文件没有下载到我的电脑上。

4

1 回答 1

0

从用户名和密码中删除 "。

Dim myURL 
Dim password
Dim username 
myURL = "https://webdav.pcloud.com/Public%20Folder/d.txt" ' change your URL here...
username = "xyz@gmail.com"
password = "xyzpassword"

Dim HttpReq 
Set HttpReq = CreateObject("Microsoft.XMLHTTP")
HttpReq.Open "GET", myURL, False, username, password
HttpReq.send
myURL = HttpReq.responseBody
If HttpReq.Status = 200 Then
    Set oStrm = CreateObject("ADODB.Stream")
    oStrm.Open
    oStrm.Type = 1
    oStrm.Write HttpReq.responseBody
    oStrm.SaveToFile "C:\d.txt", 2 ' change your path here...
    oStrm.Close
End If
于 2018-10-24T01:44:03.383 回答