How can I join two or more text files together

I would like to join two or more text files together however I need to ensure there is a blank line between the data which was found in each file.
100questionsAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Joe KlimisConnect With a Mentor Commented:
Hi
This is a powershell solution

where data.txt and data1.txt are the two files to be joined into the results file r.txt


  $(gc data.txt)  +"`n "+ $(gc data1.txt) | Out-File r.txt

Open in new window

0
 
Steve KnightIT ConsultancyCommented:
In batch one way would be something like this - will take all .txt files in c:\yourdir:

@echo off
cd /d "c:\yourdir"
(for /f %%a in ('dir /b /a-d *.txt') do (
 type "%%~a"
 echo.
)) > outfile.txt

Open in new window

Steve
0
 
100questionsAuthor Commented:
@JoeKlimis - Thanks Joe, this works well.  How would I specify the path of each input file.
0
SMB Security Just Got a Layer Stronger

WatchGuard acquires Percipient Networks to extend protection to the DNS layer, further increasing the value of Total Security Suite.  Learn more about what this means for you and how you can improve your security with WatchGuard today!

 
Joe KlimisCommented:
I have included the file paths

$(gc c:\temp\data.txt)  +"`n "+ $(gc d:\temp2\data1.txt) | Out-File e:\temp3\r.txt

Open in new window


you can always use wildcards too (*) as follows

$(gc c:\temp\data*.txt)  +"`n "+ $(gc d:\temp2\A*.txt) | Out-File e:\temp3\r.txt

Open in new window

0
 
100questionsAuthor Commented:
Excellent, works well.
0
 
Steve KnightIT ConsultancyCommented:
Could you post in area relating to language wanted only another time please to save wasting time?
0
All Courses

From novice to tech pro — start learning today.