mirror of https://github.com/Gnucash/gnucash
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.5 KiB
50 lines
1.5 KiB
' script to download perl install file and save on local disc
|
|
' the location of which is provided by first argument
|
|
|
|
|
|
Const WindowsFolder = 0
|
|
Const SystemFolder = 1
|
|
Const TemporaryFolder = 2
|
|
Dim fso: Set fso = CreateObject("Scripting.FileSystemObject")
|
|
Dim tempFolder: tempFolder = fso.GetSpecialFolder(TemporaryFolder)
|
|
|
|
strHDLocation = Wscript.Arguments.Item(0)
|
|
|
|
' Set your settings
|
|
strFileURL = "http://strawberry-perl.googlecode.com/files/strawberry-perl-5.12.3.0.msi"
|
|
|
|
Wscript.Echo " copying " & strFileURL
|
|
Wscript.Echo " to " & strHDLocation
|
|
|
|
|
|
' Fetch the file
|
|
Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP")
|
|
|
|
objXMLHTTP.open "GET", strFileURL, false
|
|
objXMLHTTP.send()
|
|
|
|
If objXMLHTTP.Status = 200 Then
|
|
Set objADOStream = CreateObject("ADODB.Stream")
|
|
objADOStream.Open
|
|
objADOStream.Type = 1 'adTypeBinary
|
|
|
|
objADOStream.Write objXMLHTTP.ResponseBody
|
|
objADOStream.Position = 0 'Set the stream position to the start
|
|
|
|
Set objFSO = Createobject("Scripting.FileSystemObject")
|
|
If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile strHDLocation
|
|
|
|
objADOStream.SaveToFile strHDLocation
|
|
objADOStream.Close
|
|
Set objADOStream = Nothing
|
|
If objFSO.Fileexists(strHDLocation) Then
|
|
Wscript.Echo " "
|
|
Wscript.Echo " " & strHDLocation & " downloaded OK"
|
|
Wscript.Echo " "
|
|
Set objFSO = Nothing
|
|
wscript.quit 0
|
|
End if
|
|
End if
|
|
|
|
wscript.quit 1
|