computing
  • 4

Batch File To Add Line To Top Of Data

  • 4

Hello!

Using batch commands, I’d like to know how to add line to top and bottom of data in a file. Thanks!!!

For example, the original data is:

12345
54321
22222
33333

And I’d like it to look like this:

***New top line***

12345
54321
22222
33333

***New bottom line***

Share

1 Answer

  1. Slightly shorter:

    —————————-
    @echo off
    echo ***New top line*** > temp.txt
    type myfile >> temp.txt
    echo ***New bottom line*** >> temp.txt
    move /y temp.txt myfile

    =====================================
    Helping others achieve escape felicity

    M2

    • 0