Download a file with VBS

前端 未结 5 1313
我寻月下人不归
我寻月下人不归 2020-11-29 00:37

Ive got a VBS Script that,generates an url to download a file from a server on my network. I now need to download the file to \"C:\\rWallpaper\\wallpaper.png\",

5条回答
  •  春和景丽
    2020-11-29 01:33

    You can download using XMLHTTP and leverage an ADO stream to write the binary data;

    dim xHttp: Set xHttp = createobject("Microsoft.XMLHTTP")
    dim bStrm: Set bStrm = createobject("Adodb.Stream")
    xHttp.Open "GET", "http://example.com/someimage.png", False
    xHttp.Send
    
    with bStrm
        .type = 1 '//binary
        .open
        .write xHttp.responseBody
        .savetofile "c:\temp\someimage.png", 2 '//overwrite
    end with
    

提交回复
热议问题