title: Weird behaviour in Powershell script
body: <p>I check out a working copy of a project using Checkout-WorkingCopy and later delete the directory using Cleanup-WorkingCopy (the code for these functions is at the end of this post).</p>
  
  <p>Problems I am facing:</p>
  
  <ol>
  <li>Instead of echoing <code>"Checking out from svn://somePath1 <strong><em>to</em></strong> C:/somePath2"</code> it echoes <code>"Checking out from svn://somePath1 C:/somePath2 <strong><em>to</em></strong>"</code></li>
  <li><p>In Cleanup-WorkingCopy, it throws the following error while trying to execute <code>Pushd</code>,<pre>
  &lt;Push-Location : Cannot convert 'System.Object[]' to the type 'System.String' 
  required by parameter 'LiteralPath'. Specified method is not supported.
  &nbsp;&nbsp;&nbsp;&nbsp;+ Pushd &lt;&lt;&lt;&lt;  $directory
  &nbsp;&nbsp;&nbsp;&nbsp;+ CategoryInfo : InvalidArgument: (:) [Push-Location], ParameterBindingException
  &nbsp;&nbsp;&nbsp;&nbsp;+ FullyQualifiedErrorId : CannotConvertArgument,Microsoft.PowerShell.Commands.PushLocationCommand></pre></p></li>
  <li><p>Finally, I get the error <code>"The syntax of the command is incorrect"</code> while executing <code>Rmdir</code>.</p></li>
  </ol>
  
  <p>The functions I use are given below. I have checked the arguments sent to the functions and they are correct.</p>
  
  <pre><code>#Checks out a copy from svnPath into appFilePath
  Function Checkout-WorkingCopy($svnPath, $appFilePath) {
  
      Echo "Checking out from $svnPath to $appFilePath"
  
      svn checkout $svnPath $appFilePath --quiet
  
      Echo "Checkout Done"
  }
  
  #Deletes the working copy previously checked out
  Function Cleanup-WorkingCopy($directory, $appFilePath) {
  
      Pushd $directory
      Cmd /C "Rmdir /S /Q $appFilePath"
  }
  </code></pre>