Batch File to add a line to all txt files

Microsoft Windows vista ultimate - 32-bi...
January 18, 2011 at 09:10:21
Specs: Windows Vista, 1ghz 4 gig
Hi,

I have a lot of text files with different information. I want to add
"EDITION: testfolder" to the top of all *.txt files and keep their information.

example:

song1.txt
song2.txt
song3.txt

each containing
"ARTIST: x" (for x = 1 to 3)

and I want the "EDITION: testfolder" to addded to the top of each txt file
song1.txt:
"EDITION: testfolder"
"ARTIST: 1"

song2.txt:
"EDITION: testfolder"
"ARTIST: 2"

song3.txt:
"EDITION: testfolder"
"ARTIST: 3"

any help would be appreciated - there are a lot of subfolders
Thank you in advance


See More: Batch File to add a line to all txt files

Report •


#1
January 19, 2011 at 04:57:04
@echo off & setLocal EnableDELAYedeXpansion

for /f "tokens=* delims= " %%a in ('dir/b *.txt') do (
> # echo."EDITION: testfolder"
for /f "tokens=* delims= " %%i in (%%a) do (
>> # echo.%%i
)
move /y # %%a
)


=====================================
Life is too important to be taken seriously.

M2


Report •
Related Solutions


Ask Question