<p>I need to be able to load the entire contents of a text file and load it into a variable for further processing.  </p>

<p>How can I do that?</p>

<hr>

<p>Here's what I did thanks to Roman Odaisky's answer.</p>

<pre><code>SetLocal EnableDelayedExpansion
set content=
for /F "delims=" %%i in (test.txt) do set content=!content! %%i

echo %content%
EndLocal
</code></pre>

Use
```
for
```
, something along the lines of:
```
```
set content=
for /f "delims=" %%i in ('filename') do set content=%content% %%i
```
```
Maybe you’ll have to do
```
setlocal enabledelayedexpansion
```
and/or use
```
!content!
```
rather than
```
%content%
```
. I can’t test, as I don’t have any MS Windows nearby (and I wish you the same :-).
The best batch-file-black-magic-reference I know of is at
http://www.rsdn.ru/article/winshell/batanyca.xml
. If you don’t know Russian, you still could make some use of the code snippets provided.