27

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.

Update:Since it is true that it does not work in DOS 1.x then is it possible to get that output using some functionality of virtual box or say by getting the output from some log files.

  • 18
    Why are you using DOS 1.25?! – Keltari Aug 24 '16 at 23:24
  • 41
    @Keltari: No annoying Windows 10 update notifications – Mark K Cowan Aug 25 '16 at 11:31
  • 6
    If you have any other questions about your setup that wouldn't be on-topic here, try Retrocomputing, another SE site dedicated to that sort of thing. (Full disclosure: I may be a little bit affiliated with that site.) – wizzwizz4 Aug 25 '16 at 13:08
  • 4
    This question makes me feel young again! – Dmitry Grigoryev Aug 25 '16 at 14:44
  • 9
    MS-DOS 1.x is essentially a CP/M clone, where Ctrl-P triggered copying the console output to the printer. A similar approach may therefore be possible in MS-DOS too. – Thorbjørn Ravn Andersen Aug 25 '16 at 15:09
5

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

  • Could you give some additional info about that process, please? – Blake Aug 28 '16 at 15:28
  • @Blake updated, seems info vgatext works afterall all you have to do is to write a correct script for debugger it seems – strangeqargo Aug 28 '16 at 21:30
  • The info you gave is very interesting. In fact it may be absolutely usable for my situation. I am using this for old application which I want to understand how it is working by giving it input and getting output automatically. It may be not the best way but I want to do it like this. Thank you for the answer, just give me day or two to read this manual and write some sort of script (hope it is possible) and will give you information on whether it works. Thank you a lot. – Blake Aug 29 '16 at 0:23
  • 1
    If I haven't already marked answer, I would definitely mark this. Thank you for all of your help guys. – Blake Aug 29 '16 at 15:17
  • 1
    I needed to get output of my application as a text. In the documentation is mentioned how to use the debug console in the terminal. Using VBoxManaged debugvms <name of the already started in debug mode VM> info vgatext it prints you the screen in terminal mode and them using redirection and some sort of simple parsing I managed to get what I needed. Thank you. – Blake Aug 29 '16 at 17:21
40

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.

  • 13
    Nice answer. Only the truest of Super Users would care at all about MS-DOS 1.0. – Twisty Impersonator Aug 24 '16 at 23:00
  • Thank you for your answer, I appreciate it but I want to find a way (say using virtual box functions) that is why I will not mark It as answer for the moment. – Blake Aug 25 '16 at 7:04
  • @Blake Possible workaround would be to capture the screen (as text) and parse the output. I have updated the answer. – DavidPostill Aug 25 '16 at 7:37
  • I am sorry in advance for the delay of the results when trying to use this tsr programs. As soon as I get access to my machine I will let you know. It is great alternative and I am hoping so much to work properly. Is it necessary to install any other programs (which for example creates this tsr environment)? – Blake Aug 25 '16 at 8:01
  • 1
    @Blake Not that I can remember, but it is many years since I used DOS. Don't worry about the delays in you testing ;) – DavidPostill Aug 25 '16 at 8:04
-3

You could install C and write a program to take the dos commands, run them in a shell and log the results. I would recommend that you use Borland Turbo C 2.01. You can also write code in Quickbasic if you are looking to write code... ;-)

https://archive.org/details/msdos_borland_turbo_c_2.01

Personally, I would use DOS 5.5 or 6 given that there are a few additional things that you would get.

  • 1
    Do this work in v1.25? – Blake Aug 25 '16 at 19:14
  • And if so, can you give me some additional help on installing C and how to log the results, thank you very much. – Blake Aug 25 '16 at 19:25
  • 1
    @Blake it does not work in v1 – edc65 Aug 25 '16 at 20:25
  • Using C to write a program would be a helpful answer, if it mentioned the APIs that you would use when writing such a program. (And, of course, took into account the explicit requirement in the question that the code be compatible with DOS 1.x.) This answer does neither. It just spams a link to a popular compiler/IDE package, with no guidance on the relevance of such a toolset. – Cody Gray Aug 26 '16 at 11:51
  • The C compiler has facilities for stdin and stdout and it can run shell commands. I don't know which compiler would work in DOS 1. If you are so concerned about maintaining the board, a better question would be why would anyone write code for MS DOS 1... – Gandolf989 Aug 26 '16 at 22:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.