Suppressing DOS Output
Published By | Date | Version | Knowledge Level | Keywords |
---|---|---|---|---|
Revelation Technologies | 07 MAY 1990 | 2.X | NOVICE | DOS, OUTPUT, MESSAGES, PC, PCPERFORM, SUPPRESSING |
DOS commands frequently confirm their execution by printing to the screen. This is desirable when you execute the command from the operating system. However, it can be an annoyance when you execute the command from within Advanced Revelation via a PC command from TCL or a PCPERFORM command in an R/BASIC program.
Fortunately, DOS has provided a mechanism by which the output can be suppressed. This is the NUL device.
Most people are familiar with two DOS output devices: the screen and the printer. DOS also allows you to specify other output devices such as files or serial port devices (example: modems). NUL is an output device defined by DOS to mean nothing. That is, any output directed to NUL simply disappears; it does not display or print anywhere.
To redirect output to a new device, use the redirection symbol, >. For example, from DOS enter:
DIR
Note that you get the familiar DOS directory listing. Now try the same command, only this time direct the output to NUL:
DIR > NUL
DOS still produces the directory listing but it displays on the NUL device. In other words, the output of the DIR command is suppressed.
From within Advanced Revelation, try the following commands from TCL, comparing the differences:
PC DIR PC DIR > NUL PC EXIT DIR > NUL
This technique is useful for hiding the DOS messages that flash across the screen when your routines execute operating system commands. Not only does this produce a cleaner application, but the user need not worry about what those messages might mean.