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
| Option Explicit
Dim MaCommande,URL,File
URL = "http://www.developpez.net/forums/d1441476/general-developpement/programmation-systeme/windows/scripts-batch/copier-coller-site-web/"
File = "file.html"
MaCommande = "GRABURL.EXE "& DblQuote(URL) & " > " & DblQuote(File) & "& Start /wait " & File &""
Call Executer(MaCommande,0,False)'La valeur 0 pour cacher la console MS-DOS
'**************************************************************************************************************
Function Executer(StrCmd,Console,bWaitOnReturn)
Dim ws,MyCmd,Resultat
Set ws = CreateObject("wscript.Shell")
'La valeur 0 pour cacher la console MS-DOS
If Console = 0 Then
MyCmd = "CMD /C " & StrCmd & ""
Resultat = ws.run(MyCmd,Console,bWaitOnReturn)
If Resultat = 0 Then
Else
MsgBox "Une erreur inconnue est survenue !",16,"Une erreur inconnue est survenue !"
End If
End If
'La valeur 1 pour montrer la console MS-DOS
If Console = 1 Then
MyCmd = "CMD /K " & StrCmd & " "
Resultat = ws.run(MyCmd,Console,bWaitOnReturn)
If Resultat = 0 Then
Else
MsgBox "Une erreur inconnue est survenue !",16,"Une erreur inconnue est survenue !"
End If
End If
Executer = Resultat
End Function
'***********************************************************************************************************
Function DblQuote(Str)
DblQuote = Chr(34) & Str & Chr(34)
End Function
'********************************************************************************************** |
Partager