To download multiple files from internet with Powershell

below script would be useful to download files from a text file which has  a url list.. it like your powershell download manager….:)

$folder = “E:ThinkPad T420s”
$userAgent = “Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1”
$web = New-Object System.Net.WebClient
$web.Headers.Add(“user-agent”, $userAgent)

Get-Content “E:WIPScriptsurls.txt” |
    Foreach-Object {
        “Downloading ” + $_
        try {
            $target = join-path $folder ([io.path]::getfilename($_))
            $web.DownloadFile($_, $target)
        } catch {
            $_.Exception.Message
        }
    }

Leave a Comment