$files = Get-ChildItem -Path "C:\Folder\*.txt" $output = @() foreach ($file in $files) { $output += Get-Content -Path $file.FullName } Set-Content -Path "C:\Folder\output.txt" -Value $output
$files = Get-ChildItem -Path "C:\Folder\*.txt" $output = @() foreach ($file in $files) { $output += Get-Content -Path $file.FullName } Set-Content -Path "C:\Folder\output.txt" -Value $output