-3
0
I have got plenty of *.cpp files in my directory. I have successfully merged file using the below command which i got from one of the sites online.
for %f in (*.cpp) do type "%f" >> Merged.doc
Now i have got a file (Merged.doc) with the contents of all my .cpp files. I want to add blank page at the end of each .cpp while merging or I would like to have each .cpp files in different pages in the Merged file .
As the below command (from another question). Is there any command similar to :
type *.cpp > merged.doc
Here each file starts after a newline like this it should start in a new page.
EDIT
What if i need to add a four lines of text before each program . Suppose if i want to add the Date associated with each file in the line Date : DD-MM-YYYY what should i do and also what should i do to add the file name with File Name : abcd.cpp(I don't want his .cpp).
I'm new to this commands so please excuse me. I don't know why i have got a -ve vote for this question.
What i did :
@echo off
cd C:\programs
echo ^<html^>^<head^>^<style^> pre {page-break-after: always;} ^</style^>^</head^>^<body^> >merged.html
for /r %%f in (*.cpp) do (
echo ^<pre^>
echo File Name :(Here i want the date associated with each file without the extension .cpp)
echo File Description :
echo Author :Name
echo Date :(Here the date associated with each program)
echo.
type "%%f"
echo ^</pre^>
) >>merged.html
echo ^</body^>^</html^> >> merged.html
ERROR in the resultant file
After #include there is not or or or . But with my original program file it is all available.I does not have he whole program only the half part of each program is on the resultant file.What is the problem with the batch file?
This is really lame. The answer is that text file no longer support page breaks because printers no longer support
/b
escape codes. If you want to have real working page breaks then you'll need to convert this to something else. I would suggest html if you want to print this. If you want page breaks for formatting alone then it cannot be done because almost no text editors support that escape code anymore (which once again is because it is useless when printing anyway). – krowe – 2015-03-07T15:19:15.487You could count lines but that'll only work for a specific font and font size. You haven't given us that and even if you did it would be a pain to figure out for you. If you wanted to do this then just go here: http://stackoverflow.com/questions/5664761/how-to-count-no-of-lines-in-text-file-and-store-the-value-into-a-variable-using
– krowe – 2015-03-07T15:21:07.157I'm ready to convert my file to any type but after everything i should be able to convert it into .doc or .rtf file . – CodeIt – 2015-03-07T15:21:21.260
@manutd Please don't keep changing your question to add new requirements after you have already have an answer. If you have another question, please ask it by clicking the Ask Question button.
– DavidPostill – 2015-03-15T14:16:55.133