Skip to main content

Escape Characters in Windows

Escape Characters in Windows

The various versions of Microsoft Windows interpret the caret character (^) and percent character (%) differently from one another. A specific line of text may also be interpreted differently depending on whether you type it into a “batch” window (DOS prompt) or include it as input in a batch script.

The following table gives the different input sequences required to represent the following line on different operating systems:

cterm /console=cn_ap:cache[USER]:^%D
Operating System Differences
Operating System Environment Rule Input Sequence
Windows 7 DOS prompt No escaping needed cterm /console=cn_ap:cache[USER]:^%D
Windows NT, Windows 2000, Windows XP DOS prompt Double caret (^) characters cterm /console=cn_ap:cache[USER]:^^%D
Windows 7, Windows NT, Windows 2000, Windows XP Batch file Double caret (^) characters

Double percent (%) characters

cterm /console=cn_ap:cache[USER]:^^%%D
Windows 9x, Windows ME DOS prompt or batch file Double percent (%) characters cterm /console=cn_ap:cache[USER]:^%%D

For other operating systems, consult the documentation for the relevant operating system.

FeedbackOpens in a new tab