Q:

How can I add text to the beginning of multiple text files using a batch file?

Hi I want to add text to the beginning of multiple .txt files in Windows. 
For example, I want to add my name to the beginning of all the .txt files in a folder. I have tried:
for %%a in (*.txt) do type myname >> %%a  

(where myname is a file containing my name)
But that adds the line to the end of the file which is not what I want. 
Is there a similar way to add text to the beginning of all of my .txt files?
EDIT: 
After trying out a few things I came up with this:
@echo off
    for %%a in (*.txt) do (
    copy /b myname + %%a %%a.txt
    move "%%a.txt" "%%a"
)

This works correctly and puts the text contained in the file myname at the top of each .txt in the folder.

A:

This will do what you're asking. Basically it's creating a new file with my name at the top, then appending the original file to it. Then deletes the original and renames the new file to the originals name. No reason you couldn't 'type' any file to the beginning by replacing my echo statement.
@echo off
for /r %%a in (*.txt) do (
echo ---- %%a before ----
type "%%a"
echo --------------------

echo 'bert' > "%%a.tmp"
type "%%a" >> "%%a.tmp"
del "%%a"
move "%%a.tmp" "%%a"

echo ---- %%a affter ----
type "%%a"
echo --------------------
)

The output I get is:
C:\Users\Bert\Documents\test>addMyNameToTop.bat
---- C:\Users\Bert\Documents\test\test.txt before ----
testing 1-2-3
--------------------
        1 file(s) moved.
---- C:\Users\Bert\Documents\test\test.txt affter ----
'bert'
testing 1-2-3
--------------------

C:\Users\Bert\Documents\test>

