There's a few questions floating around for how to download files with PowerShell. I'm using PowerShell Core, so I cannot use my favorite method anymore: Start-BitsTransfer.
I see this recommended:
Invoke-WebRequest URL -OutFile c:\file.ext
However it seems suboptimal to have to give the file name. Can PowerShell/iwr guess the file name based on the URL path or the response headers?
I tried Invoke-WebRequest URL alone, but that doesn't store the file at all. From reading the docs it looks like there may be no option for that, is that correct? Is there a different one-liner in PowerShell to download a file using its original file name?