I've seen a lot of answers to this question using a for-loop for writing a program's output line by line into a variable. This is pretty much exactly what I need BUT from what I understand it relies on the program terminating and then being able to iterate over a known number of lines.
My case is this: I have a program "example.exe" that will not terminate on its own but continuously output lines of data. I will run this program from a batch script with a few arguments and I want the lines of this program to end up in a variable "LINE" so that whenever there is a new output by that program I want the "LINE" to update and run a few extra lines of code doing something with the new set variable.
in pseudo code:
Set LINE=*example.exe output*
echo %LINE%
... some more operations on LINE
How can I achieve this without having to terminate "example.exe" and preferably without having to pipe everything into a file and then reading back from that file?