Search code examples
templatesbatch-fileheredoc

heredoc for Windows batch?


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..


Solution

  • 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.)