home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / doshelp / helpsb.zoo / help / batch / hints / quiet.hlp < prev    next >
Encoding:
Text File  |  1989-01-01  |  2.0 KB  |  51 lines

  1.                        QUIET BATCH FILES
  2.  
  3. Normally commands in a BATCH file are displayed ("echoed") on the screen as 
  4. they are processed by COMMAND.COM. Frequently it is desirable to suppress 
  5. such displays. Since ECHO ON is assumed at the beginning of each batch file 
  6. by COMMAND.COM, the first statement in many batch files is 
  7.  
  8.     ECHO OFF
  9.  
  10. Such a batch file is called a "quiet" batch file. Of course, this statement 
  11. is displayed. 
  12.  
  13. There are four ways to suppress even this single display. The most drastic 
  14. is to patch or modify the COMMAND.COM program, so that it assumes ECHO OFF 
  15. at the beginning of each batch file. The second way (available only in DOS 
  16. 3.3 and later) is to put an @ character in front of the initial ECHO OFF 
  17. command. The third way can be used with any level of DOS, provided that the 
  18. line DEVICE=ANSI.SYS is present in the CONFIG.SYS file. The following 
  19. commands at the beginning of a batch file will erase the ECHO OFF statement 
  20. from the screen almost immediately.
  21.  
  22.     ECHO OFF
  23.     ECHO ^[[80D^[[A^[[K^[[A
  24.  
  25. The effect of "^[" (the ESC character) in the second ECHO command is explained 
  26. in the PROMPT ESCAPE_SEQUENCES topic. In OS/2 only, a /Q option can be added 
  27. to the command line executing the batch file.
  28.  
  29. To further reduce output to the screen, some messages from DOS commands and 
  30. other programs can be redirected to the NUL: device name. For example, 
  31.  
  32.     COPY OLD NEW > NUL
  33.  
  34. will copy OLD to NEW as usual, but the status message 
  35.  
  36.     1 File(s) copied 
  37.  
  38. will not be displayed on the screen. A wholesale elimination of screen 
  39. displays by the batch file is possible by including the statement
  40.  
  41.     CTTY NUL
  42.  
  43. near the beginning of the file. All output will be redirected to the NUL
  44. device. Also, all input is expected to come from the NUL device, so if any
  45. program in the batch file expects input from the keyboard, put the line
  46.  
  47.     CTTY CON
  48.  
  49. in front of it. The above line must also be executed before the batch file
  50. terminates. Otherwise, you must reboot the system.
  51.