When writing batch files,
I found out some people uses Echo.
,Echo/
,Echo(
etc...These echo a blank line, so what is the difference between these Echo[Special Character]
?
You can use many different characters with echo
.
One of .[]+\:/,;=(
.
But there are multiple requirements for a good choice.
It should create an empty line (not ECHO iS OFF
)
The first point works for all characters (from the list).
The second point fails for \:.
with content like \..\..\..\windows\system32\calc.exe
@echo off
setlocal EnableDelayedExpansion
set var=\..\..\..\windows\system32\calc.exe
echo.!var!
,;=
fails with /?
and /
fails with ?
@echo off
setlocal EnableDelayedExpansion
set var=/?
echo=!var!
The third point fails for .[]+
echo echo HELLO FROM %~f0 > echo[.bat
echo[ This fails
The only one that works always is echo(