VBS Téléchargement application
Bonjour à tous voilà mon idée de base...
Télécharger un ensemble d'application (exe) provenant de lien html vers un répertoire X de mon ordi...Actuellement j'ai un script qui le fait mais auquel j'aimerais modifier quelques éléments.
De base le script
Code:
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 35 36 37 38 39 40 41 42 43 44
|
HTTPDownload "http://le_lien_du.exe" , "C:\le\répertoire\Logiciels\1\"
Sub HTTPDownload( myURL, myPath )
' Written by Rob van der Woude
' http://www.robvanderwoude.com
' Standard housekeeping
Dim i, objFile, objFSO, objHTTP, strFile, strMsg
Const ForReading = 1, ForWriting = 2, ForAppending = 8
' Create a File System Object
Set objFSO = CreateObject( "Scripting.FileSystemObject" )
' Check if the specified target file or folder exists,
' and build the fully qualified path of the target file
If objFSO.FolderExists( myPath ) Then
strFile = objFSO.BuildPath( myPath, Mid( myURL, InStrRev( myURL, "/" ) + 1 ) )
ElseIf objFSO.FolderExists( Left( myPath, InStrRev( myPath, "\" ) - 1 ) ) Then
strFile = myPath
Else
WScript.Echo "ERROR: Target folder not found."
Exit Sub
End If
' Create or open the target file
Set objFile = objFSO.OpenTextFile( strFile, ForWriting, True )
' Create an HTTP object
Set objHTTP = CreateObject( "WinHttp.WinHttpRequest.5.1" )
' Download the specified URL
objHTTP.Open "GET", myURL, False
objHTTP.Send
' Write the downloaded byte stream to the target file
For i = 1 To LenB( objHTTP.ResponseBody )
objFile.Write Chr( AscB( MidB( objHTTP.ResponseBody, i, 1 ) ) )
Next
' Close the target file
objFile.Close( )
End Sub |
J'aimerais pouvoir télécharger plusieurs application à partir du même script...mais les télécharger dans des répertoires différents
De même j'aimerais que si l'application est présente, (il y a comparaison des 2 versions) l'exécution passe à la suivante...
petite info je remarque que le processus wscript.exe ne se termine pas après exécution...
Pour le moment je lance plusieurs .vbs (pour chacune des application que je veux télécharger) à l'aide d'un batch et à la fin du batch je kill le process mais encore ça ne fonctionne pas :(
Bon voilà...je tente de visualiser le tout mais aimerait avoir des idées
Merci