I'm using following script to download files using powershell.
$folder = "c:\temp\"
$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 "c:\temp\URL_List.txt" |
Foreach-Object {
"Downloading " + $_
try {
$target = join-path $folder ([io.path]::getfilename($_))
$web.DownloadFile($_, $target)
} catch {
$_.Exception.Message
}
}
The URL_List.txt file has list of URL's I'm trying to download files from. Here's a sample URL from the list: https://drive.google.com/uc?export=download&id=0B84LPHCa2YmdZmFMV0dsYl9FeTg If you look at the URL there's no absolute file name in the URL so I'm not sure how to set the target parameter for WebClient.DownloadFile() method.