Share via


echo '>' and '<'

'>' and '<' are special characters in command prompt. They means input and output redirect. So they can't be directly echoed in command prompt. You need to escape them with '^'.

C:\>echo <
The syntax of the command is incorrect.

C:\>echo ^<
<

This is mentioned in https://www.microsoft.com/windowsxp/home/using/productdoc/en/default.asp?url=/windowsxp/home/using/productdoc/en/ntcmds_shelloverview.asp

The following characters are special and have to be escaped:
<, >, |, &, or ^,

Comments

  • Anonymous
    May 14, 2004
    Interesting I never knew that... you learn something new every day.

    Thanks,
    Wes
  • Anonymous
    May 14, 2004
    Same here, I thought backslash is the escape char..
  • Anonymous
    July 20, 2004
    I know <, >, | and ^ is the escaping character, what is "&" used for in command lines?
  • Anonymous
    July 20, 2004
    The comment has been removed