-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWebDownload.cmd
More file actions
34 lines (25 loc) · 828 Bytes
/
WebDownload.cmd
File metadata and controls
34 lines (25 loc) · 828 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
@echo off
set Source=%1
set DestDir=%~dp0
set DestFile=%2
set script=%temp%\WebDownload.vbs
call :WriteFile set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP.6.0")
call :WriteFile xmlhttp.open "GET", "%Source%", False
call :WriteFile xmlhttp.send
call :WriteFile set oStream = createobject("adodb.stream")
call :WriteFile oStream.type = 1
call :WriteFile oStream.open
call :WriteFile oStream.write xmlhttp.responseBody
call :WriteFile oStream.saveToFile "%DestFile%", 2
call :WriteFile set oStream = nothing
call :WriteFile set xmlhttp = nothing
call :WriteFile ' Self Delete
call :WriteFile Set fso = CreateObject("Scripting.FileSystemObject")
call :WriteFile Set f1 = fso.GetFile("%script%")
call :WriteFile f1.Delete
"%script%"
exit /b
:WriteFile
echo %* >>"%script%"
rem call :Debug written %* "%script%"
goto :eof