I'm pretty sure this question should have been asked before, but I can't find the answer. I want to read the content of the serial buffer and echo it to the console / terminal / standard output.

Requirements:

CMD / batch commands, no powershell it must be a oneliner preferably using copy , type , more and other simple commands like these.

Attempts:

A. First assuming I have set the parameters:

mode COM7:9600,N,8,1,P

Then from here I have tried

copy COM7 CON

and

type COM7

but it just doesn't return anything.

B. Also answers on this page are for copying the content of the serial buffer to a file, but I need to print it to the terminal or at least store it in a variable.

C. From here I also tried:

set /P "var=" < COM7 & echo %var%

but it just returns %var% obviously not reading the buffer. Adding the cmd /V:ON /C at the beginning of the above command also did not help.

D. from this page

copy COM7 > CON

and

copy COM7 2>&1

and

copy COM7 | more

all led to the error:

Access is denied. 0 file(s) copied.

I would appreciate if you could help me find the right command. Thanks for your help in advance.