title: PowerShell - Download file(s) from URL that does not include file name in the URL
body: <p>I've searched around and tried a few things and have not gotten it to work.
  The link would be for example: <code>http://www.website com/file/[fileID]</code> (e.g. <code>http://www.website com/file/1wA5fT</code>) and a box would appear whether to save the file(s) or not.</p>
  
  <p>I have tried this, from what I can remember and it did not work.</p>
  
  <pre><code>$source = "http://www.website.com/file/[fileID]"
  $dest = "C:\Users\Charles\Desktop\Downloads\"
  
  $wc = New-Object System.Net.WebClient
  $wc.DownloadFile($source, $dest)
  </code></pre>
  
  <p>Edit:</p>
  
  <p>I am able to correctly download the file if I put a filename for the destination. However I need to extract the filename from e.g.</p>
  
  <p><code>&lt;a href="http://www.website.com/file/[fileID]"&gt;Filename.txt&lt;/a&gt;&lt;/li&gt;&lt;/div&gt;&lt;/ul&gt;</code></p>
  
  <p>After I get this singled out how would I single out the filename into $Filename?</p>
  
  <pre><code>$source = "http://www.website.com/file/[fileID]"
  $dest = "C:\Users\Charles\Desktop\Downloads\$Filename"
  
  $wc = New-Object System.Net.WebClient
  $wc.DownloadFile($source, $dest)
  </code></pre>
  
  <p>This code would work then.</p>