126

Is there a way to write an IF OR IF conditional statement in a windows batch-file?

For example:

IF [%var%] == [1] OR IF [%var%] == [2] ECHO TRUE
aschipfl
  • 33,626
  • 12
  • 54
  • 99
Anthony Miller
  • 15,101
  • 28
  • 69
  • 98
  • 9
    No. What is possible is to directly write an AND: `IF [%var%]==[1] IF [%var2%]==[2] ECHO BOTH ARE TRUE`. I used to define `SET AND=IF` and then write: `IF cond1 %AND% cond2 ECHO BOTH ARE TRUE`. – Aacini Dec 09 '11 at 03:29
  • Does this answer your question? [Logical operators ("and", "or") in DOS batch](https://stackoverflow.com/questions/2143187/logical-operators-and-or-in-dos-batch) – Toni Apr 14 '21 at 15:29
  • 1
    Nice trick with SET AND=IF :-) But don't try to use ELSE after such pseudo logic operation :-) – Alexander Gavriliuk Jul 16 '21 at 15:49

19 Answers19

113

The zmbq solution is good, but cannot be used in all situations, such as inside a block of code like a FOR DO(...) loop.

An alternative is to use an indicator variable. Initialize it to be undefined, and then define it only if any one of the OR conditions is true. Then use IF DEFINED as a final test - no need to use delayed expansion.

FOR ..... DO (
  set "TRUE="
  IF cond1 set TRUE=1
  IF cond2 set TRUE=1
  IF defined TRUE (
    ...
  ) else (
    ...
  )
)

You could add the ELSE IF logic that arasmussen uses on the grounds that it might perform a wee bit faster if the 1st condition is true, but I never bother.

Addendum - This is a duplicate question with nearly identical answers to Using an OR in an IF statement WinXP Batch Script

Final addendum - I almost forgot my favorite technique to test if a variable is any one of a list of case insensitive values. Initialize a test variable containing a delimitted list of acceptable values, and then use search and replace to test if your variable is within the list. This is very fast and uses minimal code for an arbitrarily long list. It does require delayed expansion (or else the CALL %%VAR%% trick). Also the test is CASE INSENSITIVE.

set "TEST=;val1;val2;val3;val4;val5;"
if "!TEST:;%VAR%;=!" neq "!TEST!" (echo true) else (echo false)

The above can fail if VAR contains =, so the test is not fool-proof.

If doing the test within a block where delayed expansion is needed to access current value of VAR then

for ... do (
  set "TEST=;val1;val2;val3;val4;val5;"
  for /f %%A in (";!VAR!;") do if "!TEST:%%A=!" neq "!TEST!" (echo true) else (echo false)
)

FOR options like "delims=" might be needed depending on expected values within VAR

The above strategy can be made reliable even with = in VAR by adding a bit more code.

set "TEST=;val1;val2;val3;val4;val5;"
if "!TEST:;%VAR%;=!" neq "!TEST!" if "!TEST:;%VAR%;=;%VAR%;"=="!TEST!" echo true

But now we have lost the ability of providing an ELSE clause unless we add an indicator variable. The code has begun to look a bit "ugly", but I think it is the best performing reliable method for testing if VAR is any one of an arbitrary number of case-insensitive options.

Finally there is a simpler version that I think is slightly slower because it must perform one IF for each value. Aacini provided this solution in a comment to the accepted answer in the before mentioned link

for %%A in ("val1" "val2" "val3" "val4" "val5") do if "%VAR%"==%%A echo true

The list of values cannot include the * or ? characters, and the values and %VAR% should not contain quotes. Quotes lead to problems if the %VAR% also contains spaces or special characters like ^, & etc. One other limitation with this solution is it does not provide the option for an ELSE clause unless you add an indicator variable. Advantages are it can be case sensitive or insensitive depending on presence or absence of IF /I option.

dbenham
  • 127,446
  • 28
  • 251
  • 390
  • Unfortunately for won't work with values that include question marks such as FOR %%A IN (-? -h -help) due to the file match semantics. – Killroy Apr 29 '13 at 08:59
  • @Killroy - yes, I had already noted that limitation in the answer. But your comment forced me to look at the answer and realize there are additional limitations with the FOR solution. I've updated the end of the answer a bit. – dbenham Apr 29 '13 at 12:34
  • Wouldn't an echo to findstr be an option? – Squashman Jun 27 '18 at 15:32
  • @Squashman - Ugh, yes, if you want to navigate all the FINDSTR bugs and quirks. – dbenham Jun 27 '18 at 16:50
  • 2
    The answer is wrong. The command attributed to Aacini fails as quoted, but works if edited as follows: for %%A in ("val1" "val2" "val3" ) do if "%VAR%"==%%A echo true – Ed999 Jul 08 '20 at 01:08
65

I don't think so. Just use two IFs and GOTO the same label:

IF cond1 GOTO foundit
IF cond2 GOTO foundit

ECHO Didn't find it
GOTO end

:foundit
ECHO Found it!

:end
Aconcagua
  • 24,880
  • 4
  • 34
  • 59
zmbq
  • 38,013
  • 14
  • 101
  • 171
  • Yeah as far as I can tell those two are the only option. – Anthony Miller Dec 08 '11 at 22:25
  • 1
    =D I'm actually in the process of learning powershell and adapting all of my scripts. But just needed to do a small bug fix to a batch script and wanted to know if this was possible. I'm picky when it comes to clean code lol – Anthony Miller Dec 08 '11 at 22:32
  • 1
    In many situations CALL may be preferable to GOTO, although this only works if you don't need the ELSE clause. – Harry Johnston Dec 09 '11 at 04:32
  • @HarryJohnston it depends on if it is just a top-down program/script or if its structured to run as if functions existed in batch-scripting =/. In his example, GOTO would be correct or else you would hit the `ECHO Didn't find it` even if it did find it. – Anthony Miller Dec 12 '11 at 15:05
  • How difficult is it to let bat support the or operator? It has not been implemented in 2019. – huang Aug 13 '19 at 01:23
  • You should really use Powershell in 2019. – zmbq Aug 13 '19 at 12:18
  • 1
    Correct English would read "Didn't find it". I was going to edit the question, but did find that someone has already done it, then did found that it got rolled back. – Bigue Nique Sep 29 '19 at 16:36
13

A simple "FOR" can be used in a single line to use an "or" condition:

FOR %%a in (item1 item2 ...) DO IF {condition_involving_%%a} {execute_command}  

Applied to your case:

FOR %%a in (1 2) DO IF %var%==%%a ECHO TRUE

Suppress executing twice

A comment pointed out that {execute_command} may be encountered twice. To avoid this, you can use a goto after the first encounter.

FOR %%a in (1 2) DO IF %var%==%%a (
    ECHO TRUE
    goto :continue
)
:continue 

If you think there's a possibility that {execute_command} might be executed twice and you don't want that, you can just add && goto :eof:

FOR %%a in (1 2) DO IF %var%==%%a ECHO TRUE && goto :eof

Much simpler, and still on a single line.

Magoo
  • 77,302
  • 8
  • 62
  • 84
Apostolos
  • 3,115
  • 25
  • 28
  • I found this to be the most straight forward and simple to use case in my batch scripts. How come this never made it as the recommended answer? – myusrn Sep 19 '18 at 18:06
  • Thanks. I don't know, upvoting in general is a very strange process (and dubious?), not only in stackoverflow but also in other forums. But in this case, I guess it's timing. The question is quite old and my answer vere recent. Anyway, we must be happy when we can find *any* answer that works. :) – Apostolos Sep 21 '18 at 10:21
  • One _possible_ drawback with this technique (although I like the _out-of-the-boxness_ of the approach!) is that _depending on the condition_, it _may_ be possible to execute the command twice, which might not be wanted. – TripeHound Oct 24 '19 at 07:01
  • Theoretically, yes. But I have created hundreds of batch files, I use dozens of them everyday and I never met such a case. So let's stay in practice! :) – Apostolos Oct 24 '19 at 19:13
  • I have such a case today where I don't want to execute the condition twice. I want to do something if either file a or file b exists. – Simon Streicher Jan 30 '21 at 12:33
  • Please tell me what is the case that you had yesterday. I'm curious! – Apostolos Jan 31 '21 at 15:02
10

Thanks for this post, it helped me a lot.

Dunno if it can help but I had the issue and thanks to you I found what I think is another way to solve it based on this boolean equivalence:

"A or B" is the same as "not(not A and not B)"

Thus:

IF [%var%] == [1] OR IF [%var%] == [2] ECHO TRUE

Becomes:

IF not [%var%] == [1] IF not [%var%] == [2] ECHO FALSE
Gwenc37
  • 2,064
  • 7
  • 18
  • 22
Cactus
  • 101
  • 1
  • 2
  • But this only provides the FALSE (ELSE) branch if neither is true. The OP wants the TRUE branch if either is true. – dbenham Jun 30 '14 at 12:59
  • @dbenham that would be adding ELSE. The answer is great – Alex from Jitbit Sep 06 '21 at 08:49
  • @AlexfromJitbit - Yes, if you could put parentheses around the two IF statements and then execute an ELSE, that would give the correct answer. But there is no simple way to do that in batch. That is why a temporary helper variable is often used. – dbenham Sep 08 '21 at 15:46
7

Even if this question is a little older:

If you want to use if cond1 or cond 2 - you should not use complicated loops or stuff like that.

Simple provide both ifs after each other combined with goto - that's an implicit or.

//thats an implicit IF cond1 OR cond2 OR cond3
if cond1 GOTO doit
if cond2 GOTO doit
if cond3 GOTO doit

//thats our else.
GOTO end

:doit
  echo "doing it"

:end

Without goto but an "inplace" action, you might execute the action 3 times, if ALL conditions are matching.

dognose
  • 20,360
  • 9
  • 61
  • 107
4

There is no IF <arg> OR or ELIF or ELSE IF in Batch, however...

Try nesting the other IF's inside the ELSE of the previous IF.

IF <arg> (
    ....
) ELSE (
    IF <arg> (
        ......
    ) ELSE (
        IF <arg> (
            ....
        ) ELSE (
    )
)
Andrew Rasmussen
  • 14,912
  • 10
  • 45
  • 81
  • 3
    This is not a good implementation of OR because the conditional code to be executed must be replicated for each ELSE IF. (unless of course the conditional code is a GOTO, in which case you have a more verbose form of zmbq's solution.) – dbenham Dec 08 '11 at 22:57
3

The goal can be achieved by using IFs indirectly.

Below is an example of a complex expression that can be written quite concisely and logically in a CMD batch, without incoherent labels and GOTOs.

Code blocks between () brackets are handled by CMD as a (pathetic) kind of subshell. Whatever exit code comes out of a block will be used to determine the true/false value the block plays in a larger boolean expression. Arbitrarily large boolean expressions can be built with these code blocks.

Simple example

Each block is resolved to true (i.e. ERRORLEVEL = 0 after the last statement in the block has executed) / false, until the value of the whole expression has been determined or control jumps out (e.g. via GOTO):

 ((DIR c:\xsgdde /w) || (DIR c:\ /w)) && (ECHO -=BINGO=-)

Complex example

This solves the problem raised initially. Multiple statements are possible in each block but in the || || || expression it's preferable to be concise so that it's as readable as possible. ^ is an escape char in CMD batches and when placed at the end of a line it will escape the EOL and instruct CMD to continue reading the current batch of statements on the next line.

@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION

(
    (CALL :ProcedureType1 a b) ^
        || (CALL :ProcedureType2 sgd) ^
            || (CALL :ProcedureType1 c c)
) ^
    && (
        ECHO -=BINGO=-
        GOTO :EOF
    )
ECHO -=no bingo for you=-
GOTO :EOF

:ProcedureType1
    IF "%~1" == "%~2" (EXIT /B 0) ELSE (EXIT /B 1)
GOTO :EOF (this line is decorative as it's never reached)

:ProcedureType2
    ECHO :ax:xa:xx:aa:|FINDSTR /I /L /C:":%~1:">nul
GOTO :EOF
bogdan
  • 161
  • 1
  • 9
2

It's possible to use a function, which evaluates the OR logic and returns a single value.

@echo off
set var1=3
set var2=5
call :logic_or orResult "'%var1%'=='4'" "'%var2%'=='5'"
if %orResult%==1 ( 
    echo At least one expression is true
) ELSE echo All expressions are false
exit /b

:logic_or <resultVar> expression1 [[expr2] ... expr-n] 
SETLOCAL
set "logic_or.result=0"
set "logic_or.resultVar=%~1"

:logic_or_loop 
if "%~2"=="" goto :logic_or_end 
if %~2 set "logic_or.result=1"
SHIFT 
goto :logic_or_loop 

:logic_or_end 
( 
  ENDLOCAL 
  set "%logic_or.resultVar%=%logic_or.result%"
  exit /b
) 
jeb
  • 78,592
  • 17
  • 171
  • 225
  • +1, This function is a good candidate for returning the result in the ERRORLEVEL return code. Then the call can use the convenient `&& ... || ...` syntax directly instead of the extra `IF ... ELSE ...` statement. – dbenham Sep 10 '14 at 11:36
2

There is no OR operator but you can write (the pseudocode)

IF [%var%] == [1] OR IF [%var%] == [2] ECHO TRUE

like

IF "%var%" == "1" SET "match=y"
IF "%var%" == "2" SET "match=y"
IF DEFINED match ECHO TRUE

Note that the double quotes prevents a syntax error from being triggered if var is undefined.

August Karlstrom
  • 10,773
  • 7
  • 38
  • 60
1
If %x%==1 (
If %y%==1 (
:: both are equal to 1.
)
)

That's for checking if multiple variables equal value. Here's for either variable.

If %x%==1 (
:: true
)
If %x%==0 (
If %y%==1 (
:: true
)
)
If %x%==0 (
If %y%==0 (
:: False
)
)

I just thought of that off the top if my head. I could compact it more.

1

I realize this question is old, but I wanted to post an alternate solution in case anyone else (like myself) found this thread while having the same question. I was able to work around the lack of an OR operator by echoing the variable and using findstr to validate.

for /f %%v in ('echo %var% ^| findstr /x /c:"1" /c:"2"') do (
    if %errorlevel% equ 0 echo true
)
AKAJim
  • 47
  • 1
  • 4
  • 10
1

While dbenham's answer is pretty good, relying on IF DEFINED can get you in loads of trouble if the variable you're checking isn't an environment variable. Script variables don't get this special treatment.

While this might seem like some ludicrous undocumented BS, doing a simple shell query of IF with IF /? reveals that,

The DEFINED conditional works just like EXIST except it takes an environment variable name and returns true if the environment variable is defined.

In regards to answering this question, is there a reason to not just use a simple flag after a series of evaluations? That seems the most flexible OR check to me, both in regards to underlying logic and readability. For example:

Set Evaluated_True=false

IF %condition_1%==true (Set Evaluated_True=true)
IF %some_string%=="desired result" (Set Evaluated_True=true)
IF %set_numerical_variable% EQ %desired_numerical_value% (Set Evaluated_True=true)

IF %Evaluated_True%==true (echo This is where you do your passing logic) ELSE (echo This is where you do your failing logic)

Obviously, they can be any sort of conditional evaluation, but I'm just sharing a few examples.

If you wanted to have it all on one line, written-wise, you could just chain them together with && like:

Set Evaluated_True=false

IF %condition_1%==true (Set Evaluated_True=true) && IF %some_string%=="desired result" (Set Evaluated_True=true) && IF %set_numerical_variable% EQ %desired_numerical_value% (Set Evaluated_True=true)

IF %Evaluated_True%==true (echo This is where you do your passing logic) ELSE (echo This is where you do your failing logic)
kayleeFrye_onDeck
  • 6,648
  • 5
  • 69
  • 80
0

Never got exist to work.

I use if not exist g:xyz/what goto h: Else xcopy c:current/files g:bu/current There are modifiers /a etc. Not sure which ones. Laptop in shop. And computer in office. I am not there.

Never got batch files to work above Windows XP

  • As written in your example, "if not exist g:xyz/what", xyz/what is relative to the current directory of the g: drive, which may not be g's root folder. Do you need "g:\xyz\what" here? Same with c:current/files and g:bu/current. Note that each drive has a different current folder, and it is "remembered" even if that drive is not your current working directory. – John Elion Jul 22 '18 at 15:09
0

A much faster alternative I usually use is as follows, as I can "or" an arbitrary number of conditions that can fit in variable space

@(
  Echo off
  Set "_Match= 1 2 3 "
)

Set /a "var=3"

Echo:%_Match%|Find " %var% ">nul || (
  REM Code for a false condition goes here
) && (
  REM code for a true condition goes here.
)
Ben Personick
  • 3,074
  • 1
  • 22
  • 29
0

it's quite simple, just use below

IF %var% == 1 (
ECHO TRUE)

IF %var% == 2 (
ECHO TRUE)
sbgib
  • 5,580
  • 3
  • 19
  • 26
user
  • 1
0

Another option is to display the current environment variables and exploit the default behaviour of FINDSTR:

FINDSTR "hello there" x.y searches for "hello" or "there" in file x.y.

So

SET | FINDSTR /I /X "var=1 var=2" >NUL
IF %ERRORLEVEL% EQU 0 (
    ECHO TRUE
) ELSE (
    ECHO FALSE
)

Where

/I    Specifies that the search is not to be case-sensitive.
/X    Prints lines that match exactly.

If regular expressions are preferred, use FINDSTR /R /I "^var=1$ ^var=2$" >NUL instead.

Edit: FINDSTR /R should be used if the variable string includes a space, e.g., FINDSTR /R /I "^var=1 a$ ^var=2 b$" >NUL.

Edit: If the variable string includes spaces, a literal search string should be used. E.g., FINDSTR /I /X /C:"var=1 a" /C:"var=2 b" >NUL.

andronoid
  • 25
  • 6
  • You could make this answer much more efficient, simply by changing `SET` to `SET var`, or preferably `(SET var) 2>NUL`. To perform the task as shown in the question, as a one liner, you'd simply use conditional execution, i.e. `(Set var) 2>NUL | %SystemRoot%\System32\findstr.exe /B /E /I "var=1 var=2" 1>NUL && Echo TRUE`. – Compo Dec 19 '21 at 20:09
  • @Compo Using `SET` without parameters allows for different variables, e.g., `my_test_var` and `your_test_var`. – andronoid Dec 20 '21 at 02:59
  • Your variable, and that of the OP, is specifically named `var`. Listing every variable in that case is absolutely unnecessary. and therefore inefficient. At least using `var` will only return those which have names beginning with those three characters! – Compo Dec 20 '21 at 11:38
0

I took bogdan's solution to the next level by building an extern function that is a callable and clean abstraction of IF, so it can be used in inline blocks. Don't look further, if you build a batch library anyways.

lib.cmd

@ECHO OFF
SETLOCAL ENABLEEXTENSIONS
SHIFT & GOTO:%1
: Common batch extension library.

:::
: Performs conditional processing in batch programs. Is callable for inline use.
: Arguments:
:   %1 - /I for case-insensitive comparison on strings, can be skipped for case-sensitive comparison.
:   %2 - NOT to negate the result, can be skipped.
:   %3 - EXIST for file checks or first string to compare with, also supports "string1"=="string2" (full condition).
:   %4 - If EXIST is specified, path to the directory or file. 
:        Otherwise if %3 is not a full condition, this argument has to be one of:
:        - ==   Compares both strings to be equal using lstrcmpW or lstrcmpiW (case-insensitive).
:        - EQU  Converts both strings to numbers and checks if they are equal. 
:        - NEQ  Converts both strings to numbers and checks if they are not equal.
:        - LSS  Converts both strings to numbers and checks if the first is lesser than the second.
:        - LEQ  Converts both strings to numbers and checks if the first is lesser or equal than the second.
:        - GTR  Converts both strings to numbers and checks if the first is greater than the second.
:        - GEQ  Converts both strings to numbers and checks if the first is greater or equal than the second.
:        If a string cannot be parsed to a number, its numeric representation will be used. 
:        This argument can be skipped, so == will be used.
:   %5 - If %3 is not a full condition, this argument has to be the second string to compare.
: Outputs:
:   Nothing
: Returns:
:   0, if the condition is met, 1 otherwise
:::
:test-if
IF "%~1"=="/I" SET "I=/I " & SHIFT
IF "%~1"=="/i" SET "I=/I " & SHIFT
IF "%~1"=="NOT" SET "NOT=NOT " & SHIFT
IF "%~1"=="not" SET "NOT=NOT " & SHIFT
IF "%~1"=="EXIST" SET "EXIST=EXIST " & SHIFT
IF "%~1"=="exist" SET "EXIST=EXIST " & SHIFT

SET "string1=%~1%"
IF "%~3"=="" (
    SET "comp=^=^="
    SET "string2=%~2"
) ELSE (
    SET "comp=%~2"
    SET "string2=%~3"
)
IF %I%%NOT%%EXIST% "%string1%" %comp% "%string2%" (
    ENDLOCAL & EXIT /B 0
)
ENDLOCAL & EXIT /B 1

Usage

( ( CALL lib test-if "%1" == "foo" ) || ( CALL lib test-if "%1" == "bar" ) ) && (
    ECHO "Argument is foo or bar"
)
  • lib is the path to the lib.cmd, the suffix .cmd is not mandatory for cmd-files
  • Any IF syntax is compatible with this abstraction, so you can also do things like test-if EXIST "path" or test-if not 300 LSS 200
  • The == in test-if "%1" == "foo" will be stripped away by batch and I address this fact in my case, but this causes test-if "%1" "foo" to be valid as well, it's not the standard though.
Martin Braun
  • 10,906
  • 9
  • 64
  • 105
-1

In my script, I am prompting the user for a Yes/No question like this:

Do you want to proceed? (y/n):

Now I wanted this 'y' and 'n' to be case-INsensitive. I mean Y and y should be considered the same.

Now for it to case INsensitive, all I did is

SET /p "myPrompt= Do you want to proceed? (y/n): "

IF "%myPrompt%"=="y" OR "%myPrompt%"=="Y" (
    // do this
) ELSE (
    // do that
)

So in your case, it would be

IF [%var%] == [1] OR [%var%] == [2] ECHO TRUE

A simple OR between the 2 checks does the trick. I don't know why the other answers have complicated something that is so easy.

  • OR doesn't work in cmd/batch. (Btw: to make it case insensitive, use `if`'s `/i` switch - or even better, switch to the `choice` command) – Stephan Apr 14 '23 at 16:33
  • Hi @Stephan, could you please elaborate on the choice command? Maybe I can make use of it. Thanks in advance. – tabrezshaikh13 Apr 15 '23 at 17:45
  • When `choice /?` or [SS64](https://ss64.com/nt/choice.html) don't help, use the search function of this site (at the very top) - there are plenty of Q&As using `choice`. – Stephan Apr 15 '23 at 17:52
-3

Realizing this is a bit of an old question, the responses helped me come up with a solution to testing command line arguments to a batch file; so I wanted to post my solution as well in case anyone else was looking for a similar solution.

First thing that I should point out is that I was having trouble getting IF ... ELSE statements to work inside of a FOR ... DO clause. Turns out (thanks to dbenham for inadvertently pointing this out in his examples) the ELSE statement cannot be on a separate line from the closing parens.

So instead of this:

FOR ... DO (
    IF ... (
    )
    ELSE (
    )
)

Which is my preference for readability and aesthetic reasons, you have to do this:

FOR ... DO (
    IF ... (
    ) ELSE (
    )
)

Now the ELSE statement doesn't return as an unrecognized command.

Finally, here's what I was attempting to do - I wanted to be able to pass several arguments to a batch file in any order, ignoring case, and reporting/failing on undefined arguments passed in. So here's my solution...

@ECHO OFF
SET ARG1=FALSE
SET ARG2=FALSE
SET ARG3=FALSE
SET ARG4=FALSE
SET ARGS=(arg1 Arg1 ARG1 arg2 Arg2 ARG2 arg3 Arg3 ARG3)
SET ARG=

FOR %%A IN (%*) DO (
    SET TRUE=
    FOR %%B in %ARGS% DO (
        IF [%%A] == [%%B] SET TRUE=1
        )
    IF DEFINED TRUE (
        SET %%A=TRUE
        ) ELSE (
        SET ARG=%%A
        GOTO UNDEFINED
        )
    )

ECHO %ARG1%
ECHO %ARG2%
ECHO %ARG3%
ECHO %ARG4%
GOTO END

:UNDEFINED
ECHO "%ARG%" is not an acceptable argument.
GOTO END

:END

Note, this will only report on the first failed argument. So if the user passes in more than one unacceptable argument, they will only be told about the first until it's corrected, then the second, etc.

Andrew Barber
  • 39,603
  • 20
  • 94
  • 123
RMWChaos
  • 885
  • 1
  • 11
  • 11
  • -1 This question had nothing to do with 'IF syntax in a FOR loop' nor how to pass arguments properly, but had to do with discovering a way to replication an If.. Or.. If statement in a batch file. – Anthony Miller Sep 10 '12 at 13:11
  • 1
    Fair enough. Guess I was answering my own question that these answers helped me with rather than being careful to answer the OP's original question. Will be more careful in the future. Thanks Mechaflash! -R – RMWChaos Sep 13 '12 at 14:22
  • 1
    If you have a question similar in nature, have solved that question on your own, and there is no question posted on stackoverflow that's the same as your own, you can pose it as a question and check the box to answer it yourself. That way it will be on the site and people can respond to it as well. – Anthony Miller Sep 13 '12 at 14:38