Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
drgt
- Posts: 160
- Joined: 21 Sep 2010 02:22
- Location: Greece
#1
Post
by drgt » 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?
Last edited by
drgt on 14 Nov 2021 12:10, edited 1 time in total.
-
T3RRY
- Posts: 250
- Joined: 06 May 2020 10:14
#2
Post
by T3RRY » 14 Nov 2021 04:44
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:
-
drgt
- Posts: 160
- Joined: 21 Sep 2010 02:22
- Location: Greece
#3
Post
by drgt » 14 Nov 2021 12:15
Thank you for showing my omission
Answers
1
Code: Select all
C:\>if 2 gtr 1 (echo greater) else (echo equal or lesser)
2
-
aGerman
- Expert
- Posts: 4678
- Joined: 22 Jan 2010 18:01
- Location: Germany
#4
Post
by aGerman » 15 Nov 2021 05:27
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
-
drgt
- Posts: 160
- Joined: 21 Sep 2010 02:22
- Location: Greece
#5
Post
by drgt » 18 Nov 2021 23:40
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"
-
jeb
- Expert
- Posts: 1055
- Joined: 30 Aug 2007 08:05
- Location: Germany, Bochum
#6
Post
by jeb » 19 Nov 2021 02:12
-
drgt
- Posts: 160
- Joined: 21 Sep 2010 02:22
- Location: Greece
#7
Post
by drgt » 20 Nov 2021 03:17
Thank you JEB