www.cryer.co.uk
Brian Cryer's Web Resources

CryEcho: Command line flags

CryEcho with no arguments will generate the following summary help information showing each of the command line flags it can take:

C:\>CryEcho
CryEcho - from www.cryer.co.uk 1.0 (build November 2011)
A console application which displays a message to standard out.
Unlike "echo" it does not automatically add a newline.

 CryEcho [+n|-n] [-q] message

Where:
 -n  echoes the message without a newline. This is the default.
 +n  echoes the message with a newline at the end.
 -q  ignores any double quotes.

The following character substitutions are performed before echoing:

 \a - Alert; buzzer beep on most PCs
 \b - Backspace
 \n - Newline
 \r - Carriage return
 \s - Space
 \t - Tab
 \" - Double quote
 \\ - Single back-slash

What these flags mean:

-n
Do not echo a carriage return at the end. This is the default behaviour of CryEcho, so it is unlikely that you would want to use this flag.
+n
Echo a carriage return at the end. The default behaviour of CryEcho is not to include a newline after it has displayed the message, adding this flag forces CryEcho to add a newline at the end. This makes its behaviour almost the same as the in-build echo command.

So:

C:\>CryEcho +n message

produces the same output as:

C:\>CryEcho message\n

or the more traditional:

C:\>echo message

-q
Ignore (or remove) any double quotes. So any double quotes (except double quotes which are escaped) will not be echoed.

What the substitutions mean:

\a
Echo the alert character. This normally sounds the buzzer briefly.
\b
Backspace. This allows the previous character to be deleted.

So:

C:\>CryEcho 1\b2

will produce:

2

Actually it produces "1" followed by a backspaced followed by "2", which ends up as showing a "2". But if you were to pipe the output from CryEcho to a file then that file would capture all three characters.

\n
Newline.

So:

C:\>CryEcho 1\n2

will produce:

1
2

\r
Carriage return. A carriage return moves the print position (or the position where the next character will be printed) to the start of the current line.

So:

C:\>CryEcho 123\r45 

will produce:

453

As the "45" has overprinted the start of "123".

\s
Space.
\t
Tab. A tab will advance to the next tab stop. Think of a tab stop as being 8 characters wide, then a tab will advance to the beginning of the next tab block. This can be useful when aligning output visually.

So:

C:\>CryEcho one\ttwo\three\tfour

will produce:

one     two
three   four

\"
A double quote. An escaped double quote will appear even if quotes are suppressed using the -q flag.
\\
A single slash. This allows you to echo a backslash ('\') without fear that it might be interpreted as part of another substitution.

So:

C:\>CryEcho one\\two

will produce:

one\two

Had this been a single slash then it would instead have been interpreted as "one<tab>wo".

More Information

For more information please refer to one of the following pages: