Page 1 of 1

Limiting echo & Output word "on"

Posted: 14 Nov 2021 03:35
by drgt
1. How to limit what echo is to process, without splitting the line?

example

Code: Select all

Prompt:>if 2 GTR 1 echo bigger else echo lesser
result: bigger else echo lesser
2. How to echo "ON" instead of turning echo on?

Re: Limiting echo

Posted: 14 Nov 2021 04:44
by T3RRY
drgt wrote:
14 Nov 2021 03:35
1. How to limit what echo is to process, without splitting the line?

example

Code: Select all

Prompt:>if 2 GTR 1 echo bigger else echo lesser
result: bigger else echo lesser
2. How to echo "ON" instead of turning echo on?
Your problem is not with echo, it's with your failure to use correct If else syntax:

Code: Select all

if ( command ) else othercommand

Re: Limiting echo & Output word "on"

Posted: 14 Nov 2021 12:15
by drgt
Thank you for showing my omission :(
Answers
1

Code: Select all

C:\>if 2 gtr 1 (echo greater) else (echo equal or lesser)
2

Code: Select all

C:\>echo.on

Re: Limiting echo & Output word "on"

Posted: 15 Nov 2021 05:27
by aGerman

Code: Select all

echo(on
Looks definitely weird, but we have lengthy threads here where the outcome is that the lone standing left parenthesis has the fewest side effects, while the period is rather the worst case (even if it is still quite common).

Steffen

Re: Limiting echo & Output word "on"

Posted: 18 Nov 2021 23:40
by drgt

Code: Select all

echo(on
Thanks for the alternative.
Searching for "echo the word on" (at least on the first few results) I did not see any references to the "side effects"

Re: Limiting echo & Output word "on"

Posted: 19 Nov 2021 02:12
by jeb

Re: Limiting echo & Output word "on"

Posted: 20 Nov 2021 03:17
by drgt
Thank you JEB