ECHO OFF Prevents ANSI Escape Sequences Using PROMPT

Article translations Article translations
Article ID: 71558 - View products that this article applies to.
This article was previously published under Q71558
Expand all | Collapse all


If ECHO is currently OFF in a batch file, ANSI escape sequences cannot be issued using the PROMPT $E[... statement. ECHO must be temporarily turned ON, or the escape sequences must be issued using ECHO <esc>[..., where <esc> is whatever sequence of characters is used by a particular text editor to specify an escape character (for example, ^V[ in Edlin).


When ECHO is OFF in a batch file, command lines in the batch file (including the command prompt) are not echoed to the screen. Thus, the command prompt containing the desired escape sequence is not echoed to the console, and the escape sequence is not issued. If the prompt contains an escape sequence when the batch file ends execution, this escape sequence is issued.

If the DOSSHELL command is executed from a batch file with the echo off and MS-DOS Shell is then used to execute a batch file that uses PROMPT $E[..., the escape sequence is not issued. Shell must first be terminated, either by using F3 or by explicitly setting ECHO ON, before the batch file can be used to issue escape sequences.


Article ID: 71558 - Last Review: November 16, 2006 - Revision: 2.1
  • Microsoft MS-DOS 3.1
  • Microsoft MS-DOS 3.2 Standard Edition
  • Microsoft MS-DOS 3.21 Standard Edition
  • Microsoft MS-DOS 3.3 Standard Edition
  • Microsoft MS-DOS 3.3a
  • Microsoft MS-DOS 4.0 Standard Edition
  • Microsoft MS-DOS 4.01 Standard Edition
  • Microsoft MS-DOS 5.0 Standard Edition
  • Microsoft MS-DOS 5.0a
  • Microsoft MS-DOS 6.0 Standard Edition
  • Microsoft MS-DOS 6.2 Standard Edition
  • Microsoft MS-DOS 6.21 Standard Edition
  • Microsoft MS-DOS 6.22 Standard Edition
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.

Give Feedback


Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from