No of visitors who read this post: 200
Type: Question
Author: F_canindo
No votes yet

I'd like to know how to add line to top and bottom of data in a file.

Can you help me?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

#

Hi there,

I can provide you with commands that will definitely going to add lines at top and bottom of your Batch data File,

Back up your old file and use these commands,

@echo off

echo ***New top line*** > temp.txt

for /f "tokens=*" %%a in (yourfile.txt) do (

  echo %%a >> temp.txt)

echo ***New bottom line*** >> temp.txt

echo y|del yourfile.txt

rename tempt.txt yourfile.txt

That should work out your problem,

If above given command does not works then use following command which is relatively shorter

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

Hope that works!!