Wget-DL.ps1
function Wget-DL{ param( [Parameter(Mandatory,ValueFromPipeline)] [String]$url, [ValidateScript({ if(-Not ($_ | Test-Path -PathType Container) ){ throw 'The Path argument must be a folder.' } return $true })] [IO.FileInfo]$OutDir = $PWD.Path ) process{ $OutPath = Join-Path -Path $OutDir -ChildPath $(Split-Path -Leaf -Path $url) Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $OutPath -Verbose:$VerbosePreference } } |