Sans utiliser d'utilitaires non standard (inclus Windows), est-il possible de télécharger à l'aide de la ligne de commande Windows?
La version préférée est Windows XP, mais il est également intéressant de connaître les versions plus récentes.
Pour clarifier ma question:
Donc, fondamentalement, car tout le monde hurle Wget , je veux une fonctionnalité simple de Wget, sans utiliser Wget.
Vous pouvez écrire un VBScript et l'exécuter à partir de la ligne de commande
Créez un fichier downloadfile.vbs
et insérez le contenu suivant:
' Set your settings strFileURL = "http://www.it1.net/images/it1_logo2.jpg" strHDLocation = "c:\logo.jpg" ' 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 Set objFSO = Nothing objADOStream.SaveToFile strHDLocation objADOStream.Close Set objADOStream = Nothing End if Set objXMLHTTP = Nothing
Exécutez-le à partir de la ligne de commande comme suit:
cscript.exe downloadfile.vbs