Everyone knows, that in Windows command file (.cmd
)
echo on
echo off
enables and disables echo. But how to echo only text "on" or text "off"? I.e. how to send text
on
off
to stdout
?
Target system: Windows XP.
And what about making it in DOS?
C:\> echo.on
on
C:\> echo.off
off
This actually works with a number of different characters, including but possibly not limited to:
/
, \
, ,
, :
, ;
, (
.
According to this thread on dostips.com, it's actually best (most robust) to use:
echo(on
As the other characters have obscure situations in which they can fail (e.g. a file named echo
exists on %PATH%
).