I am trying to generate an xml file. I compare two images using a command which returns a number. But when I try to redirect its output to a file, it prints the number with a newline character.
echo a.jpg >> "result.txt"
compare -metric NCC "a.jpg" "b.jpg" "c.jpg" 2>> "result.txt"
Expected output like:
a.jpg 1
But it outputs:
a.jpg
1
I tried to get the result from the command and tried to concatenate with the a.jpg but I couldn't have managed.
for /f "tokens=1 delims=" %%a in ('compare -metric NCC "a.jpg" "b.jpg" "c.jpg"') do set result=%%a
echo %result%
REM outputs 1ECHO is off.
for /f "tokens=1 delims=" %%a in ('compare -metric NCC "a.jpg" "b.jpg" "c.jpg"') do echo test %%asay?test %%apart, the output stays same which is interesting.