title: Formatting when using add-content in Powershell
body: <p>I am trying to consolidate all of the text files in a folder into one csv file with the name of each text file above its content in the new file. I would like it to come out like this (in the text files before consolidation, the text appears in a list as below, so I'd like the text to appear in the csv file in the same fashion that it exists in the text files):</p>
  
  <p><strong>textfile1.txt</strong></p>
  
  <pre>
  -content content
  
  -content content
  
  -content content
  </pre>
  
  <p><strong>textfile2.txt:</strong> </p>
  
  <pre>
  -content content
  
  -content content
  
  -content content
  </pre>
  
  <p><strong>textfile3.txt:</strong></p>
  
  <pre>
  -content content
  
  -content content
  
  -content content
  </pre>
  
  <p>However it is currently coming out like this:</p>
  
  <p><strong>textfile1.txt:</strong></p>
  
  <pre>
  content content content content content content
  </pre>
  
  <p><strong>textfile2.txt:</strong></p>
  
  <pre>
  content content content content content content
  </pre>
  
  <p><strong>textfile3.txt:</strong></p>
  
  <pre>
  content content content content content content
  </pre>
  
  <p>My code is this:</p>
  
  <pre><code>dir "C:\text files\*.*" | ForEach {
  $variable = "$($_.Name)`n$(Get-content $_.FullName)" |Add-Content
  "C:\text files\output\output.csv"}
  </code></pre>
  
  <p>If anyone can help me to format the <code>Add-Content</code> so it doesn't group the whole file into one string, I would be most thankful!</p>