Aqui está um script híbrido [Lote / Vbscript] para baixar um arquivo!
@echo off
mode con:cols=90 lines=10
title -==*==- Batch File Downloader -==*==-
(
echo Option Explicit
echo.
echo Dim Message, result
echo Dim Title, Text1, Text2
echo.
echo Message = "Type the URL of the file to download http://www.kcc.edu/campaigns/PublishingImages/poh.jpg"
echo Title = "Type the URL of the file to download"
echo Text1 = "You canceled"
echo.
echo result = InputBox^(Message, Title, "http://www.kcc.edu/campaigns/PublishingImages/poh.jpg", 900, 900^)
echo.
echo.
echo If result = "" Then
echo WScript.Echo Text1
echo Else
echo WScript.Echo result
echo End If
)>"%tmp%\inputbox.vbs"
for /f "tokens=* delims=*" %%a in ('Cscript "%tmp%\inputbox.vbs" //nologo') do (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 -^) Ignore all SSL errors
echo strURL = DownloadDest
echo Wscript.Echo "Download-URL: " ^& strURL
echo.
echo 'For basic authentication, use the list below, plus user variables? Give Way
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 Then
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 '//overwrite
echo objStream.Close
echo set objStream = Nothing
echo End If
echo.
echo.
echo set xmlhttp=Nothing
echo End function
echo.
echo getit(^)
echo Wscript.Echo "Download complete. Check " ^& LocalFile ^& " for Success."
echo Wscript.Quit(intOK^)
)>"%tmp%\httpdownload.vbs"
::Start
echo(
echo Please wait ... Download file is in progress ...
for /f "tokens=* delims=*" %%a in ('Cscript "%tmp%\httpdownload.vbs" //nologo') do (echo "%%a")
Del %tmp%\httpdownload.vbs
::End
pause>nul