title: Powershell download file not working properly
body: <p>I am trying to write a powershell script that will set a download directory variable based on the current directory, and download a file to that directory.</p>
  
  <p>The code I have is:</p>
  
  <pre><code>cd downloads
  $DevDownloadDirectory = [IO.Directory]::GetCurrentDirectory
  
  $clnt = New-Object System.Net.WebClient
  
  # download and extract the file
  $url = “fileurl/file.zip"
  $file = "$DevDownloadDirectory\file.zip"
  $clnt.DownloadFile($url,$file)
  </code></pre>
  
  <p>The problem I get is whenever I get to this part of the code it pumps out:</p>
  
  <blockquote>
    <p>Exception calling "DownloadFile" with "2" argument(s): "An exception
    occurred during a WebClient request." At C:\directory\script.ps1:462
    char:20</p>
    
    <ul>
    <li>$clnt.DownloadFile &lt;&lt;&lt;&lt; ($url,$file)</li>
    <li>CategoryInfo          : NotSpecified: (:) [], MethodInvocationException</li>
    <li>FullyQualifiedErrorId : DotNetMethodException</li>
    </ul>
  </blockquote>
  
  <p>Could anyone please help me figure out why this is happening?</p>