Back in university, when we had to submit an assignment in CS, we would have to perform a series of steps including running
script, date, whoami, etc., and then running our program.
script command would pipe all text sent to the display to both the display and a specified file as well.
Ever since, I have been looking for a Dos and/or Windows version, but have come up empty. Some programs can be redirected to a file, but then the display is not echoed, and some programs don’t seem to work with redirection at all.
So far, the answers that I’ve gotten seem to work exactly like the standard redirection commands (
<, >, |). These do not work with all programs. For example, the Microsoft C++ compiler CL.EXE. If you run
cl /? through a redirection command or pipe it through another program (such as TEE), you will not get the header/banner text.
Another example is a program I wrote a while back in Pascal (I think the last compile was in FreePascal). The help text does not get redirected at all. I have seen this occur with other programs as well like MKISOFS. It has a long help text, but cannot be paused by piping it through MORE or redirected to a file!
I have wondered about this for many years. I used to think that it may be because the text is being written directly to the screen (eg port B800) or something, but I have yet to pin down the cause, let alone find a program that can do this job.