Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
chogall
- Posts: 1
- Joined: 16 Aug 2011 07:23
#1
Post
by chogall » 16 Aug 2011 07:31
Hi!
I need to write something like :
but I want that it matches 'Q' also. So I thought about writing something like :
But it doesn't work.
Any idea how I can translate 'q' OR 'Q' ?
Thank you!
-
dbenham
- Expert
- Posts: 2461
- Joined: 12 Feb 2011 21:02
- Location: United States (east coast)
#2
Post
by dbenham » 16 Aug 2011 08:27
For this application you don't need an OR - you just need to do a case insensitive comparison:
To emulate OR between any possible conditional tests it is easiest to use a temporary variable: (pseudo code)
Code: Select all
set "TEST="
if <condition 1> set TEST=1
if <condition 2> set TEST=1
if defined TEST <condition 1 OR condition 2 is true so do whatever>
Dave Benham
-
taripo
- Posts: 228
- Joined: 01 Aug 2011 13:48
#3
Post
by taripo » 27 Aug 2011 22:05
dbenham wrote:To emulate OR between any possible conditional tests it is easiest to use a temporary variable: (pseudo code)...
Dave Benham
You say that's the easiest way. What's the hard way then?
-
Ocalabob
- Posts: 79
- Joined: 24 Dec 2010 12:16
- Location: Micanopy Florida
#4
Post
by Ocalabob » 28 Aug 2011 20:24
Greetings chogall
Try this (untested)
Code: Select all
@echo off
set /p choice="Enter q or Q "
if %choice%==q goto quit
if %choice%==Q goto quit
:quit
echo You picked %choice%
pause
set choice=
Best wishes.