I'd like to combine two files together using the copy command as follows. This is simple enough using
copy /b base.txt + file1.txt combined_file1.txt**
However the first part of the file (base.txt
) will remain constant and the second half will be from a folder full of different file (such as file1.txt
, file2.txt
, file3.txt
etc)
The output file should be the variable filename with combined_
added at the front.
I'd like a batch file that I can place inside the directory of files and have it automatically add base.txt
to the front of all the other variable files.
Get-ChildItem "Files" -Filter *.txt | Foreach-Object { (gc base.txt) + (gc ("files\"+$_.Name) ) | out-file -filepath ("files\combined_"+$_.Name)}
base.txt is in theroot
with afiles
folder containing the files.