Feeding multiline input (here documents) to commands in cmd.exe scripts
Solution 1:
I believe you can use a single ^
character for each line.
EG:
echo This is a really long ^
text message that spans multiple ^
lines
returns:
C:\Users\Jonno>echo This is a really long ^
More? text message that spans multiple ^
More? lines
This is a really long text message that spans multiple lines
Solution 2:
It's simple, but not as clean looking as it is in Unix/Linux. Try this:
(@echo.a lot of
@echo.text here
) | somecmd
Note that the .
after the echo statement allows you to begin a line with blanks. The @
symbol is needed to prevent the echo statement from being sent to somecmd
. You can eliminate the @
symbol thusly:
echo off
(echo.a lot of
echo.text here
) | somecmd
echo on