Hello!
(Using Win 7 64 bit)
I have dozens of "*.pas" files in a single directory.
I want to merge all the "*.pas" files together into one large file called "Combined.txt" in that same directory.
I want a line of astericks "************" to be written to "Combined.txt" between each "*.pas" file.
I have tried DOZENS of variations, but I can't get it to work. I HAVE READ the help files, maybe
I'm just dense.
:::::::::::::::::::::::::::Here is <PSEUDOCODE> for what I want to do :::::::::::::::::::::::::
: :
: For %%x in (*.pas) do (copy %%x /A Combined.txt ; do echo ************ >>%%x) :
: :
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Any help would be greatly appreciated.
TY
Bok
Combine Files
Moderator: DosItHelp
Re: New user question
Code: Select all
@echo off
FOR %%G in (*.pas) do (
type "%%~G">>combined.txt
echo ************>>combined.txt
)
Re: Combine Files
Thanks so much.I would have never gotten that.
I modified it with a pipe "|". It is less clear to read, but is 2 less lines long.
FOR %%G in (*.pas) do (type "%%~G">> combined.txt | echo ************>>combined.txt)
I used to do a VERY LITTLE bit of batch work way back in Win 3.0 - 3.1. Wow!!! have things changed.
I guess I'll have to find a book that takes me step by step with all the new functionality and
syntax of modern batch.
Thanks Again
Bok
I modified it with a pipe "|". It is less clear to read, but is 2 less lines long.
FOR %%G in (*.pas) do (type "%%~G">> combined.txt | echo ************>>combined.txt)
I used to do a VERY LITTLE bit of batch work way back in Win 3.0 - 3.1. Wow!!! have things changed.
I guess I'll have to find a book that takes me step by step with all the new functionality and
syntax of modern batch.
Thanks Again
Bok
Re: Combine Files
I would think you would want to use an ampersand. Not a Pipe.
Re: Combine Files
I just put it in and I got lucky- it worked; but, you are correct
I should use the "&". It's been ~20yrs since I've done batch
and I've forgotten so much and so much has changed
I should use the "&". It's been ~20yrs since I've done batch
and I've forgotten so much and so much has changed
Re: Combine Files
I too started in batch many many moons ago (DOS 3.3). But aside some from new tricks added on all the commands, you can still run a batch file from DOS 3.3 and it works. 
To me, all the changes are quite welcome as you can do things today that were really hard (if not impossible) to do in the win3.0-3.1 days.

To me, all the changes are quite welcome as you can do things today that were really hard (if not impossible) to do in the win3.0-3.1 days.