If you absolutely must use a batch file for some reason, the following code will help you accomplish your task.
@echo off && setlocal enabledelayedexpansion
set NL=^
for /f "delims=" %%i in (myfile.txt) do set fc=!fc!%%i%NL%
What is happening is the set statement is using a "bug" in the escape funcionality to store a newline in the variable NL
. The two blank lines afterward are indeed necessary. The last line iterates through the file and appends each line to the variable fc
with a trailing newline.
As far as putting the contents of the variable in a text field, this could be accomplished by many means, one being to write the html file upto and including the first textarea tag, then writing the contents of the variable, and then writing the rest of the html file.