Page 1 of 1

File List (additional text on seperate line)

Posted: 31 Aug 2021 03:28
by sark
Hi all.

I have a simple bat file that generates a list of files contained within a folder (below).

Code: Select all

(for %%f in (*.*) do @echo %%f) > list.txt 
I can add text before or after the second %%f tag, to add text before or after the file name in my list, but I would like to add some text on a seperate line before the file name (example below). How would I achieve this.

Text Here
file1.txt
Text Here
file2.txt
Text Here
file3.txt

Any advice much appreciated.

Mark

Re: File List (additional text on seperate line)

Posted: 31 Aug 2021 11:38
by aGerman

Code: Select all

>"list.txt" (for %%f in (*.*) do @echo Text here&echo %%f)
Steffen

Re: File List (additional text on seperate line)

Posted: 31 Aug 2021 15:51
by sark
Thanks for that. It,s appreciated.

Mark