1.

Solve : How to Insert a Header Row in a Text File using a Batch program.?

Answer»

New to using this FORUM and batch files, so please bear with me.
It doesn't seem like this would be hard, but I've search everywhere I can think of and can't FIND the answer.

Using Windows 7

Need to open text file, and add a static header. 

Original Text File Example:
XHD051500101103
XHE   PO#1005
XDT2496581 001
XDT2670961 001
XOE  27   33

Need it to be:
Header
XHD051500101103
XHE   PO#1005
XDT2496581 001
XDT2670961 001
XOE  27   33

Any help would be GREATLY APPRECIATED.   

With a little lateral thinking, try this

Code: [Select] >{dummy}.txt echo Header
>>{dummy}.txt type "Original Text File"
del "Original Text File"
ren {dummy}.txt "Original Text File"
SIMPLY put, create a new file with the header in
append the content of your main file
delete the main file
rename the temp file to the original main file name



Discussion

No Comment Found