Created
June 28, 2013 21:24
-
-
Save goyuix/5888259 to your computer and use it in GitHub Desktop.
PowerShell cmdlet to facilitate downloading files
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
function Download-File { | |
param( | |
[Parameter(Mandatory=$true, Position = 0)][string]$Uri, | |
[Parameter(Mandatory=$false, Position = 1)][string]$SaveAs | |
) | |
$loc = [System.IO.Path]::GetFullPath([System.IO.Path]::GetFileName($Uri)) | |
if ($SaveAs) { $loc = [System.IO.Path]::GetFullPath($SaveAs) } | |
$wc = New-Object System.Net.WebClient | |
$wc.UseDefaultCredentials = $true | |
# I just need to add in proper proxy support | |
$wc.DownloadFile($Uri, $loc) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment