Skip to content

Instantly share code, notes, and snippets.

@gravejester
Created February 26, 2013 20:37
Show Gist options
  • Save gravejester/5041943 to your computer and use it in GitHub Desktop.
Save gravejester/5041943 to your computer and use it in GitHub Desktop.
Ever wanted to download a file from the web using PowerShell? It’s quite easy actually.
# PowerShell wget
# Version 1.0
[CmdletBinding()]
param(
[Parameter(ValueFromPipeline = $true, Mandatory = $true)]
$url,
$dest = (Get-Location).Path
)
if(!$url){break}
$filesplit = $url.split("\/")
$file = $filesplit[($filesplit.length-1)]
$fulldest = $dest + "\" + $file
(New-Object System.Net.WebClient).DownloadFile($url,$fulldest)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment