heredoc for Windows batch?

Amro picture Amro · Jun 18, 2009 · Viewed 20.8k times · Source

Is there a way of specifying multiline strings in batch in a way similar to heredoc in unix shells. Something similar to:

cat <<EOF > out.txt
bla
bla
..
EOF

The idea is to create a customized file from a template file..

Answer

ephemient picture ephemient · Jun 19, 2009

Not as far as I know.

The closest I know of is

> out.txt (
    @echo.bla
    @echo.bla
    ...
)

(@ prevents the command shell itself from printing the commands it's running, and echo. allows you to start a line with a space.)