Last active
October 21, 2016 10:19
-
-
Save MiloszKrajewski/86f854fa0ed411678dea219523a56108 to your computer and use it in GitHub Desktop.
This file contains 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
param([String]$url, [String]$path="") | |
# It is a poor man's cURL, but can be used to download cURL | |
# powershell -file download.ps1 -url https://dl.uxnr.de/build/curl/curl_winssl_cross_x64/curl-7.50.3/curl-7.50.3.zip | |
# powershell -file download.ps1 -url https://cdn.rawgit.com/martinrotter/7za/master/7za.exe | |
# NOTE: may require "Set-ExecutionPolicy RemoteSigned" | |
if ($path -eq "") { | |
$path = [System.IO.Path]::GetFileName($url) | |
} | |
if (test-path $path) { | |
write-host -fore yellow "Already exists: $path" | |
} else { | |
write-host -fore green "Downloading: $url" | |
$client = new-object Net.WebClient | |
$proxy = [System.Net.WebRequest]::DefaultWebProxy | |
$proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials | |
$client.Proxy = $proxy | |
$client.DownloadFile($url, $path) | |
write-host -fore green "Saved as: $path" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment