Last active
January 7, 2020 18:32
-
-
Save rahuldottech/3a2ef4f6cbf86135628b11e6f5d28e43 to your computer and use it in GitHub Desktop.
Download with powershell. Supports HTTPS.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
powershell-download by rahuldottech | |
License: | |
MIT license - https://github.com/rahuldottech/license |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
REM Usage: | |
REM powershell_download.cmd <URL> <FILENAME> | |
REM by @rahuldottech | |
powershell -c [Net.ServicePointManager]::SecurityProtocol = 'Tls12,Tls11,Tls,Ssl3'; iwr %1 -UseB -OutF %2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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