C:\_G\WWW\~ELISANET\INFO\tscmd089.html
<http://www.elisanet.fi/tsalmi/info/tscmd089.html>
Copyright © 2003- by Prof. Timo Salmi  
Last modified Fri 30-Nov-2018 11:31:45

 
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:
  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

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

[Previous] [Next]

C:\_G\WWW\~ELISANET\INFO\tscmd089.html
C:\_G\WWW\~ELISANET\FTPCMD\TSALMI.CMD /tscmd089
http://www.elisanet.fi/tsalmi/info/tscmd089.html
file:///c:/_g/www/~elisanet/info/tscmd089.html