Downloads and saves a file in the current working directory of PowerShell.
Can you use the previous working directory ($pwd) or change it to a fixed location: “C:\Download” or by first change the directory in PowerShell.
Examples of changing the directory:
$storageDir = $pwd # or: $storageDir = "C:\Downloads" #or: cd C:\Users\Teusje\Documents $storageDir = $pwd
Below is the script to download a file via PowerShell. You can run it directly in PowerShell:
$storageDir = $pwd $webclient = New-Object System.Net.WebClient $url = "https://teusje.files.wordpress.com/2011/02/giraffe-header1.png" $file = "$storageDir\myNewFilename.jpg" $webclient.DownloadFile($url,$file)