This page is edited from the 1cmdfaq.txt faq-file contained in
my tscmd.zip
command line interface (CLI) collection. That zipped file has much
additional material, including a number of detached .cmd script
files. It is recommended that you also get the zipped version as a
companion.
Please see "
The Description and
the Index page" for the conditions of usage and other such
information.
89} All of a sudden "echo." doesn't work any more. What's wrong?
Echo is an internal command. One probable cause is that for some
reason you have accidentally created a file with that same name into
the current directory. Consider this demonstration
@echo off & setlocal enableextensions
echo whatever>echo
echo An error will occur:
echo.
del echo
echo No more the error
echo.
endlocal & goto :EOF
The output will be
C:\_D\TEST>cmdfaq
An error will occur:
'echo.' is not recognized as an internal or external command,
operable program or batch file.
No more the error
For another catch see
item #82 "Why does
echo 9>temp.txt fail while echo 10>temp.txt works?". Also
see
item #40 for the /? catch. For
additional echo tips see the item links at the end of
item #17.
Another case of seemingly unexpected (but logical) results could arise from
@echo off & setlocal enableextensions
set var=
if "%var%"=="" (echo var is empty) else (echo var is not empty)
endlocal & goto :EOF
The output will be
C:\_D\TEST>cmdfaq
var is not empty