0

My VBScript is as follows:

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

There is no error detected when I run it but the file is not downloaded on to my PC.

user692942
  • 16,398
  • 7
  • 76
  • 175
rohit7373
  • 5
  • 4

1 Answers1

0

remove " from username and password.

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
rohit7373
  • 5
  • 4