0

I was reading this question where I saw not one but two separate answers where the code provided used a form of echo( with no closing parenthesis.

What does this form of the command do?

I am familiar with echo. to perform an echo of an empty line but I've not seen this other form before.

Zhro
  • 2,546
  • 2
  • 29
  • 39
  • 4
    It does the same thing as **`.`** is usually used for, only better. Please read [this DOSTips thread](https://www.dostips.com/forum/viewtopic.php?p=2537) for reference. – Compo Jun 22 '18 at 01:44
  • it's just [a variant of echo](https://stackoverflow.com/a/20691061/995714) – phuclv Jun 22 '18 at 02:34
  • There is plenty of more definitive info on the topic. (Link above is dead though). The short answer is that it is MUCH safer to use "echo(" than it is to use "echo". Consider the case of "echo %SomeVariable%" where SomeVariable is not defined. The output will be "echo is on" or "echo is off". Not at all what you expected! I used to use "echo." until someone pointed out that you get undesirable behavior if you have a file named "echo.". So I always use "echo(" instead of "echo ". BTW, there is no such thing as a "closing parenthesis" in this case. – RGuggisberg Jun 22 '18 at 03:17
  • @RGuggisberg, if you are talking about the *DosTips* link, I can tell it's not dead; try as different browser and you'll find out (I had the same issue with that site)... – aschipfl Jun 22 '18 at 09:46
  • @aschipf, you're right. It works fine in IE and Firefox. Doesn't work from my version of Chrome. – RGuggisberg Jun 22 '18 at 12:11
  • 1
    As personal preference, I used to use `echo/%variable%` that looks less weird than `echo(%variable%`, excepting in the few cases when `%variable%` may start with `?`, that is the only case where `echo/` and `echo(` differ... – Aacini Jun 22 '18 at 16:09

0 Answers0