title: Write-Output without a newline in Powershell?
body: <p>I'm writing a small script that checks for the existence of directories, and if they exist then delete them. I am trying to have informative output, and as such I want to output a confirmation when a folder is deleted:</p>
  
  <pre><code>foreach ($e in $directoriesToRemove)
      {
          Write-Output "Deleting $e`..."
          Remove-Item $e -recurse
          Write-Output "Done"
      }
  </code></pre>
  
  <p>The output of this being:</p>
  
  <pre><code>Deleting C:\wherever\folder1...
  Done
  Deleting C:\wherever\folder2...
  Done
  </code></pre>
  
  <p>While I am aiming for:</p>
  
  <pre><code>Deleting C:\wherever\folder1... Done
  Deleting C:\wherever\folder2... Done
  </code></pre>
  
  <p>I understand that Write-Host can be used to achieve this with the -nonewline parameter, but I would like to avoid using Write-Host if possible.</p>
  
  <p>Is there a workaround for this other than waiting until a folder is deleting and writing the entire line at once?
  I've found that this line works, but I don't know if putting a delete command inside a Write-Output command is safe/best practice:</p>
  
  <pre><code>Write-Output "Deleting $e`... $(Remove-Item $e -recurse) Done"
  </code></pre>