Copyright © 2003-2011 by Prof. Timo Salmi  
Last modified Thu 8-Dec-2011 10:02:41

Assorted NT/2000/XP/.. CMD.EXE Script Tricks
From the html version of the tscmd.zip 1cmdfaq.txt file
To the Description and the Index

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:
  del echo
  echo No more the error
  endlocal & goto :EOF

The output will be
  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
  var is not empty

References/Comments: (If a Google message link fails try the links within the brackets.)
  Google Groups Apr 21 2008, 3:07 pm [M]