Microsoft KB Archive/32656

= ANSI Escape Sequence ESC[nD Not Moving Cursor to the Left =

Article ID: 32656

Article Last Modified on 5/12/2003

-

APPLIES TO


 * 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

-



This article was previously published under Q32656



SYMPTOMS
The ANSI escape sequence for Cursor Left doesn't function correctly. When you type PROMPT $e[2D ], the cursor moves all the way to the left-most column rather than moving back just two columns.



CAUSE
This behavior is by design. Each time you issue a PROMPT command, a carriage return/linefeed sequence is sent. So each time a PROMPT command is issued, the cursor is moved to column 1. If you then try to move two columns to the left, you are unable to do so because you are already at the farthest left column; the &quot;ESC[nD&quot; escape sequence has no effect if the cursor is in the farthest left column.



WORKAROUND
To avoid this situation, move the cursor in a batch file. For example, to move the cursor two columns to the left you would use the following escape sequence:   echo ESC[2D

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

Keywords: KB32656

-

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

© Microsoft Corporation. All rights reserved.