Combine multiple text files and produce a new single text file using PowerShell? - Stack Overflow

PHOTO EMBED

Tue Dec 05 2023 22:07:28 GMT+0000 (Coordinated Universal Time)

Saved by @baamn

$yourdir="c:\temp\"
$destfile= ([Environment]::GetFolderPath("Desktop") + "\totalresult.txt")
Get-ChildItem $yourdir -File -Filter *.txt | %{"________________________" |out-file  $destfile -Append; $_.Name  | Out-File  $destfile -Append; gc $_.FullName | Out-File  $destfile -Append}
content_copyCOPY

https://stackoverflow.com/questions/40286458/combine-multiple-text-files-and-produce-a-new-single-text-file-using-powershell