There is no point refeering questions like this to Retro Computing. The answer remains the same over decades, the beauty of Windows.
GetStdHandle is the function call that has worked for at least 19 years and probably 26.
Retrieves a handle to the specified standard device (standard input,
standard output, or standard error).
HANDLE WINAPI GetStdHandle(
_In_ DWORD nStdHandle
Your question is unclear. Command.com does piping, not programs. In Dos you can read/write std handles using Int21. See http://spike.scu.edu.au/~barry/interrupts.html
AH = 02h -WRITE CHARACTER TO STANDARD OUTPUT
Entry: DL = character to write
Return: AL = last character output
Notes: •^C/^Break are checked •the last character output will be the
character in DL unless DL=09h on entry, in which case AL=20h as tabs
are expanded to blanks •if standard output is redirected to a file, no
error checks (write- protected, full media, etc.) are performed
This is all documented in MS compilers of the time. I'm sure Borland documented too.