The result I'm getting seems to be a common problem where only the first line gets passed through the pipe.
Are they any hacks that I can do be able to echo/output the multi-line variable into a pipe?
Example:
Code: Select all
@echo off
setlocal enableDelayedExpansion
set NL=^
rem leave empty lines
set var=444!NL!222!NL!111!NL!444!NL!000
echo !var! | sort /r
An alternative is to put the variable into single line array variables and loop the echos, but still need it somehow combined into a single pipe.
I can't just do multiple echo's ie (echo %var1% & echo %var2%, etc), as the number of lines can be anywhere from 2 to thousands of lines.
I'm currently doing this through a temp file, but would like to avoid this to make it cleaner if possible.