vbscript - Download file from website with Batch -
i having problems downloading files internet using batch script. found following pieces of code - though none of them seem work
xcopy /e /y "https://website.com/file.bat" wget.exe --no-check-certificate https://website.com/file.bat
i trying make batch automatically fetch file, pretty clueless on how to.
i open (explained simple) vbscripts too. in advance!
this example download game.swf
try , inspired :
@echo off mode con:cols=70 lines=8 & color 9b title -==*==- batch downloader file hackoo -==*==- ( echo option explicit echo. echo dim message, result echo dim title, text1, text2 echo. echo message = "type url of file download." echo title = "download file url hackoo" echo text1 = "you canceled" echo. echo result = inputbox^(message, title, "http://www.gametop.com/online-free-games/anti-terror-force-online/game.swf", 900, 900^) echo. echo. echo if result = "" echo wscript.echo text1 echo else echo wscript.echo result echo end if )>"%tmp%\inputbox.vbs" /f "tokens=* delims=*" %%a in ('cscript "%tmp%\inputbox.vbs" //nologo') (set "a=%%a") ( echo path = "%a%" echo pos = instrrev(path, "/"^) +1 echo const downloaddest = "%a%" echo localfile = mid(path, pos^) echo const webuser = "admin" echo const webpass = "admin" echo const downloadtype = "binary" echo dim strurl echo. echo function getit(^) echo dim xmlhttp echo. echo set xmlhttp=createobject("msxml2.xmlhttp.3.0"^) echo 'xmlhttp.setoption 2, 13056 'if https -^) ignorer toutes les erreurs ssl echo strurl = downloaddest echo wscript.echo "download-url: " ^& strurl echo. echo 'pour l'authentification de base, utilisez la liste ci-dessous, ainsi que les variables + d'utilisateurs? laisser passer echo 'xmlhttp.open "get", strurl, false, webuser, webpass echo xmlhttp.open "get", strurl, false echo. echo xmlhttp.send echo wscript.echo "download-status: " ^& xmlhttp.status ^& " " ^& xmlhttp.statustext echo. echo if xmlhttp.status = 200 echo dim objstream echo set objstream = createobject("adodb.stream"^) echo objstream.type = 1 'adtypebinary echo objstream.open echo objstream.write xmlhttp.responsebody echo objstream.savetofile localfile,2 echo objstream.close echo set objstream = nothing echo end if echo. echo. echo set xmlhttp=nothing echo end function echo. echo '======================================================================= echo ' fin defs de fonction, start page echo '======================================================================= echo getit(^) echo wscript.echo "download completed. check " ^& localfile ^& " success." echo wscript.quit(intok^) )>"%tmp%\httpdownload.vbs" ::debut echo please wait ... downloading file in progress ... echo. /f "tokens=* delims=*" %%a in ('cscript "%tmp%\httpdownload.vbs" //nologo') (echo "%%a") del %tmp%\httpdownload.vbs ::fin pause>nul
Comments
Post a Comment