Do you understand this? 09-27-2012, 06:46 AM
#1
I have no idea how to use VB, but i think this is a download & execute code that works directly 4rm a url, if anyone here understands this, pls help solve it.
Original post here
http://gallery.technet.microsoft.com/scr...ea#content
Visual Basic
Original post here
http://gallery.technet.microsoft.com/scr...ea#content
Visual Basic
Code:
Dim args, num
Dim var1, var2
Dim objFSO, objFolder
Dim objStream
Dim WshShell
Dim strFolder, strURL, strFile, strFull
Dim strUnat, strCmdLine, strDmdLine
'Sets and checks arguments
set args = WScript.Arguments
num = args.Count
If num = 2 Then
'URL for the file
strURL = args.Item(0)
'Folder for the file to be downloaded to
strFolder = args.Item(1)
ElseIf num = 3 Then
strURL = args.Item(0)
strFolder = args.item(1)
strUnat = args.item(2)
Else
Wscript.Echo "Usage: \\servername\sharename\downrunsilent.vbe http://www.website.com/executable.exe C:\temp"
Wscript.Echo "For unattended options add them after download folder with a space and quotes."
WScript.Quit
End If
'Converts URL to just filename
var1 = Split(StrReverse(strURL), "/")
var2 = StrReverse(var1(0))
'Sets path for file download
strFile = var2
strFull = strFolder & "\" & strFile
'wscript.echo "File download location is: " & strFull
'Verify local folder for file and creates it if doesn't exist
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(strFolder) Then
Set objFolder = objFSO.GetFolder(strFolder)
Else
'Wcript.Echo "Download folder does not exist."
'Wscript.Echo "Creating download folder."
Set objFolder = objFSO.CreateFolder(strFolder)
End If
' Sets up an ADO Stream to download file
Set objStream = CreateObject("ADODB.Stream")
objStream.Type = 1 ' adTypeBinary
' The following starts the download
objStream.Open ("URL=" & strURL)
'wscript.echo "File downloaded"
' This saves the file to the workstation in the folder specified
objStream.SaveToFile strFolder & "\" & strFile, 2 ' adSaveCreateOverWrite
objStream.Close
Set objStream = Nothing
' Runs the downloaded file with or without unattended/silent options
If strUnat = "" Then
'wscript.echo "Executing downloaded file"
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run (chr(34) & strFull & chr(34))
Set WsShell = Nothing
Else
'WScript.echo "Executing downloaded file"
Set WshShell = CreateObject("WScript.Shell")
strCmdLine = strFull & " "
strDmdLine = strCmdLine & strUnat
WshShell.Run (strDmdLine)
Set WsShell = Nothing
End If![[Image: 9u86c5.jpg]](http://i56.tinypic.com/9u86c5.jpg)
IN WEED WE TRUST...LEGALIZE TODAY:


![[+]](https://sinister.li/images/modern/collapse_collapsed.png)

