Powershell script to download the given links in text file, it’s like your download manager

 ‘Powershell script to download the given links in text file, it’s like your download manager

$folder = “E:ThinkPad W500”
$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:WIPurls.txt” |
    Foreach-Object {
        “Downloading ” + $_
        try {
            $target = join-path $folder ([io.path]::getfilename($_))
            $web.DownloadFile($_, $target)
        } catch {
            $_.Exception.Message
        }
    }

Leave a Comment