title: Why is my PowerShell script writing blank lines to console?
body: <p>I have a bit of an odd problem. Or maybe not so odd. I had to implement a "custom clean" for a PowerShell script developed for building some unique configurations for my current project (the whys are not particularly important). Basically it copies a bunch of files from the release directories into some temporary directories with this code:</p>
  
  <pre><code>$Paths = Get-ChildItem $ProjectPath -recurse |
           Where-Object { ($_.PSIsContainer -eq $true) -and
           (Test-Path($_.Fullname + 'bin\release')) } |
           Select-Object Fullname
  
  ForEach ($Path in $Paths)
  {
       $CopyPath = $Path.Fullname + '\bin\Temp'
       $DeletePath = $Path.Fullname + '\bin\Release'
       New-Item -ItemType directory -path $CopyPath
       Copy-Item $DeletePath $CopyPath -recurse
       Remove-Item $DeletePath Recurse
  }
  </code></pre>
  
  <p>And after the build copies it back with:</p>
  
  <pre><code>ForEach ($Path in $Paths)
  {
      $CopiedPath = $Path.Fullname + '\bin\Temp\'
      $DeletedPath = $Path.Fullname + '\bin\Release\'
      $Files = Get-ChildItem $CopiedPath -recurse |
               where-object {-not $_PSIsContainer}
      ForEach ($File in $Files)
      {
          if(-not (Test-Path ($DeletedPath+$File.Name)))
          {
              Copy-Item $File.Fullname ($DeletedPath+$File.Name)
          }
      }
      Remove-Item $CopyPath -recurse -force
  }
  </code></pre>
  
  <p>This is pretty clunky and noobish (Sorry, I'm a PowerShell noob drinking from a fire hose), but it works for the purpose and I will clean it up later. However, when it executes the initial copy to the temp directories, it writes a lot of blank lines to the screen, which isn't ideal as I have a message I display while this process is executing to assure our CM doesn't freak out and think it broke, but this message is blown away by the blank lines. Do you know what might be causing this and how I might solve this? I'm using PowerShell 2.0 out of the box and due to the nature of this project I can't upgrade or get any outside libraries. Thanks guys.</p>