Microsoft KB Archive/32655

= DIR Does Not Work with ANSI Escape Sequence ESC[nh =

Article ID: 32655

Article Last Modified on 5/12/2003

-

APPLIES TO


 * Microsoft MS-DOS 3.3 Standard Edition
 * 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

-



This article was previously published under Q32655



SYMPTOMS
After you set the mode through ANSI escape sequences with the PROMPT command, the following occurs regardless of the particular mode chosen. When you call directory listing with the DIR command, the screen clears immediately after displaying the directory listing, so that you do not have a chance to look at the directory listing. However, if you type &quot;prompt $p$g&quot; (without the quotation marks) and then use the DIR command, the directory works correctly.



CAUSE
Any time you use one of the ANSI escape codes to set the screen mode, the screen is cleared. This explains why you are seeing the screen cleared after doing a DIR command.



WORKAROUND
To avoid this problem, set the screen mode in a batch file. For example, if you wanted to set the screen mode to 40x25 monochrome mode, you would insert the following text into a batch file:

echo [0h

Depending upon your editor, you would replace  with whatever character represents ESCAPE. In EDLIN, you use ^[. And in other word processors, you use the back arrow character.

Additional query words: 6.22 3.30 4.00 5.00 5.00a 6.00 6.20

Keywords: KB32655

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.