title: PowerShell Invoke-WebRequest, how to automatically use original file name?
body: <p>How can I use Invoke-WebRequest to download a file but automatically make the file name the same as if I downloaded via browser? I haven't found a way to make <code>-OutFile</code> work without manually specifying the file name. I'm fine with this involving a few other lines of code.</p>
  
  <p>A good solution will:</p>
  
  <ul>
  <li>Work even if the file name isn't in the request URL. For example, the URL to download the Visual Studio x64 Remote Debugging Tools is <code>http://go.microsoft.com/fwlink/?LinkId=393217</code> but it downloads the file <code>rtools_setup_x64.exe</code>.</li>
  <li>Not save the whole file to memory before writing to disk, unless that's what Invoke-WebRequest already does even with the -OutFile parameter (?)</li>
  </ul>
  
  <p>Thanks!</p>