1.

Solve : Batch file to add to a text file?

Answer»

I need to create a batch file, that can open a text file, add 4 lines of text to it, save and close it.

How can i do that?

Thanks for your help.Code: [Select]
@echo off
echo line1 >> filename.txt
echo line2 >> filename.txt
echo line3 >> filename.txt
echo line4 >> filename.txt


If filename.txt exists before the batch file is run, the four lines will be appended to the end. If filename.txt does not exist before the batch file is run, it will be created.

Hope this HELPS. That helps, but i wasn't clear enough.

I want to write the following lines in win.ini

Code: [Select][Internal]
Device=zcvMvMu+zr2+vbnGurnJz8e7zcY=
Install=1124174943
Install2=1124174943
Device2=zcvMvMu+zr2+vbnGurnJz8e7zcY=

The solution you gave me helps, but these lines have to be written at the BOTTOM of win.ini in a new line.

When i tried what you told me, it just wrote EVERYTHING on the first line.I don't KNOW how you got everything on one line, but:

Code: [Select]
echo [Internal] >> win.ini
echo Device=zcvMvMu+zr2+vbnGurnJz8e7zcY= >> win.ini
echo Install=1124174943 >> win.ini
echo Install2=1124174943 >> win.ini
echo Device2=zcvMvMu+zr2+vbnGurnJz8e7zcY= >> win.ini


No charge for the FIFTH line.



Discussion

No Comment Found