Page 1 of 1

How to use "or" in a batch script

Posted: 12 Sep 2011 21:38
by Rileyh
Hi,
I was wondering if someone could tell me if you can use "or" or something like it in a batch file.
For example:
if /i _"%var%"=="(something)" OR "(something)" OR "(something)" (do whatever)

Is that an accepted command or is there a command that does the same thing that I could use.

Thanks,
Rileyh

Re: How to use "or" in a batch script

Posted: 13 Sep 2011 01:40
by Ed Dyreen
'

Code: Select all

@echo off &SetLocal EnableDelayedExpansion

set /a $error = 1
::
if 1 equ 0 (
  ::
  set /a $error = 0

) else if 2 equ 0 (
  ::
  set /a $error = 0

) else if 0 equ 0 (
  ::
  set /a $error = 0
)
::
if !$error! equ 0 (
  ::
  echo. 1 equ 0 OR 2 equ 0 OR 0 equ 0 : do whatever:^)
)

EndLocal

pause
exit /b 0