Displays messages, or turns command echoing on or off.
Displays the quotes too.
Displays the contents of
echo Owner ^& son
Uses caret (
^) to escape ampersand (&), thereby enabling echoing ampersands.
echo 1&echo 2&echo 3
Displays three strings, each followed by a newline.
Outputs a newline while the period is not being output. Without the period, outputs
echo on. Adding a space before the period leads to the period being output. Other characters having the same effect as period include
While it seems to output random numbers to
MyRandomNumbers.txt, it actually does not do so for numbers 0-9, since these, when placed before
>>, indicate which channel is to be redirected. See also redirection.
Instead of echoing 2, redirects standard error to the file.
Echoes even a small number (in this case 2) and redirects the result.
>>MyRandomNumbers.txt echo 2
Another way to echo even a small number and redirect the result.
Displaying a string without a newline requires a trick:
set <NUL /p=Output of a command:
Displays "Output of a command:". The output of the next command will be displayed immediately after
set <NUL /p=Current time: & time /t
Displays "Current time: " followed by the output of
(set <NUL /p=Current time: & time /t) >tmp.txt
Like before, with redirecting the output of both commands to a file.
$ echo /? Displays messages, or turns command-echoing on or off. ECHO [ON | OFF] ECHO [message] Type ECHO without parameters to display the current echo setting.