Save the output of command in file MS-DOS 1.x

Solution 1:

you can use your virtual machine debugging facilities (or gdb/something else) to read memory directly. ms-dos has no memory protection nor it's a multi-task system, so you can read virtual machine memory, you can read virtual machine vga for input.

documentation says there exists a command

info vgatext -- print the contents of the VGA framebuffer formatted as standard text mode

the correct syntax to get output is: run VirtualBox --debug --startvm msdos1.25, then, in debugger console: info vgatext

copy-pasted output:

The COMPAQ Personal Computer DOS                                                
Version 1.11                                                                    


(C) Copyright COMPAQ Computer Corp. 1982                                        
(C) Copyright Microsoft 1981, 82                                                


A>                                                                              











--------------------------------------------------------------------------------
VBoxDbg> 

So, you can write a debugger script which hooks on a memory value inside your program's memory and dumps vga screen when a program does output / or you can write script that pauses cpu, saves content consistently, if output changes, saves updated content, continues cpu run

Some options to investigate are:

  • find how to write a debugging script for dumping memory contents of your application

  • find some debugging vga driver/serial port/memory dumping solution for quemu/dosbox/virtualbox

  • find some OLD utility program from 80's which maybe someone wrote back there for this purpose

  • add freedos tag here (or even move/repeat your question on big stackoverflow, I suppose some gurus should know a thing about problems like this

I'll update later if I find something interesting, but can you please reveal some details on why are you using 1.25, does this program works on newer versions of msdos? I bet you can find some young assembly hacker eager to patch-up this program to a newer version (or add file output with asm) for a small fee

Solution 2:

It seems that [COMMAND]>[FILE] does not work in the early versions of MS-DOS.

I am using MS-DOS 1.25 and the above expression gives the statement invalid argument

That is correct. What you want to do is not possible in v1.25.

Command redirection (along with many other improvements) was added in v2.0.

MS-DOS version 2.0 (equivalent to PC-DOS 2.0) was first released in March 1983. It was, in retrospect, a new operating system (though great care was taken to maintain compatibility with MS-DOS version 1). It contained many significant innovations and enhanced features, including those listed on the following page.

  • Support for both larger-capacity floppy disks and hard disks
  • Many UNIX/XENIX-like features, including a hierarchical file structure, file handles, I/O redirection, pipes, and filters
  • Background printing (print spooling)
  • Volume labels, plus additional file attributes
  • Installable device drivers
  • A user-customizable system-configuration file that controlled the loading of additional device drivers, the number of system disk buffers, and so forth
  • Maintenance of environment blocks that could be used to pass information between programs
  • An optional ANSI display driver that allowed programs to position the cursor and control display characteristics in a hardware-independent manner
  • Support for the dynamic allocation, modification, and release of memory by application programs
  • Support for customized user command interpreters (shells)
  • System tables to assist application software in modifying its currency, time, and date formats (known as international support)

Source Advanced MS-DOS Programming By Ray Duncan


What can I do instead?

A possible workaround would be to capture the screen (as text) and parse the output.

The answers to this question Screen capture in DOS list some TSR (Terminate but Stay Resident) programs that are starting points for you to investigate.