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)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s