Instantly share code, notes, and snippets.

Embed
What would you like to do?
Download with powershell. Supports HTTPS.
@echo off
REM Usage:
REM powershell_download.cmd <URL> <FILENAME>
REM by @rahuldottech
powershell ([Net.ServicePointManager]::SecurityProtocol = "[Net.SecurityProtocolType]::tls12, [Net.SecurityProtocolType]::tls11, [Net.SecurityProtocolType]::tls, [Net.SecurityProtocolType]::ssl3") -and (wget %1 -UseBasicParsing -OutFile %2)
powershell -c [Net.ServicePointManager]::SecurityProtocol = 'Tls12,Tls11,Tls,Ssl3'; iwr %1 -UseB -OutF %2
@echo off
echo Downloading file!
call :psd "https://<URL>/" "<filename>"
echo %errorlevel%
REM %errorlevel% is 0 if download was successful, 1 if failed.
:psd
powershell ([Net.ServicePointManager]::SecurityProtocol = "[Net.SecurityProtocolType]::tls12, [Net.SecurityProtocolType]::tls11, [Net.SecurityProtocolType]::tls, [Net.SecurityProtocolType]::ssl3") -and (wget %~1 -UseBasicParsing -OutFile %~2) >nul
goto :eof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment