Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!helios.ee.lbl.gov!nosc!cod!baird From: baird@cod.NOSC.MIL (John M. Baird) Newsgroups: comp.sys.ibm.pc Subject: Re: How to hide 'echo off' in batch files? Message-ID: <1546@cod.NOSC.MIL> Date: 5 Jun 89 15:48:15 GMT References: <9139@boulder.Colorado.EDU> Organization: Naval Ocean Systems Center, San Diego Lines: 57 From article <9139@boulder.Colorado.EDU>, by haverlan@tramp.Colorado.EDU (HAVERLAND MARC BRADLEY): > > Does anyone know how to turn off echoing in a batch file without > showing the 'echo off?' See below. John Baird NAVAL OCEAN SYSTEMS CENTER, San Diego, CA ------- My friendly DOS HELP command has this to say on the subject: QUIET BATCH FILES Normally commands in a BATCH file are displayed ("echoed") on the screen as they are processed by COMMAND.COM. Frequently it is desirable to suppress such displays. Since ECHO ON is assumed at the beginning of each batch file by COMMAND.COM, the first statement in many batch files is ECHO OFF Such a batch file is called a "quiet" batch file. Of course, this statement is displayed. There are four ways to suppress even this single display. The most drastic is to patch or modify the COMMAND.COM program, so that it assumes ECHO OFF at the beginning of each batch file. The second way (available only in DOS 3.3 and later) is to put an @ character in front of the initial ECHO OFF command. The third way can be used with any level of DOS, provided that the line DEVICE=ANSI.SYS is present in the CONFIG.SYS file. The following commands at the beginning of a batch file will erase the ECHO OFF statement from the screen almost immediately. ECHO OFF ECHO ^[[80D^[[A^[[K^[[A The effect of "^[" (the ESC character) in the second ECHO command is explained in the PROMPT ESCAPE_SEQUENCES topic. In OS/2 only, a /Q option can be added to the command line executing the batch file. To further reduce output to the screen, some messages from DOS commands and other programs can be redirected to the NUL: device name. For example, COPY OLD NEW > NUL will copy OLD to NEW as usual, but the status message 1 File(s) copied will not be displayed on the screen. A wholesale elimination of screen displays by the batch file is possible by including the statement CTTY NUL near the beginning of the file. All output will be redirected to the NUL device. Also, all input is expected to come from the NUL device, so if any program in the batch file expects input from the keyboard, put the line CTTY CON in front of it. The above line must also be executed before the batch file terminates. Otherwise, you must reboot the system.