2 "IF / ELSE" decisions, 4 combinations - reduce to 2 result
Posted: 24 Jan 2010 14:41
I would like to simplify / reduce
IF %A%==4 (DEFAULT CODE) ELSE IF %B% NEQ 6 (DEFAULT CODE) ELSE (SPECIAL CODE)
What I have shown above as DEFAULT CODE could be multiple lines - and is written twice.
I am attracted to
http://www.dostips.com/DtCodeSnippets.p ... lExecution
Command1 && (CommandBlock2 & REM) || (CommandBlock3)
I assume that this would work as well
(Command1) && (SPECIAL CODE & REM) || (DEFAULT CODE)
What does not work for me is
(IF %A%==4 IF %B% NEQ 6) && (SPECIAL CODE & REM) || (DEFAULT CODE)
I am hoping that some-one knows a clever way of wrapping two conditionals as a (COMMAND1)
So far all I can think of is
Alan
IF %A%==4 (DEFAULT CODE) ELSE IF %B% NEQ 6 (DEFAULT CODE) ELSE (SPECIAL CODE)
What I have shown above as DEFAULT CODE could be multiple lines - and is written twice.
I am attracted to
http://www.dostips.com/DtCodeSnippets.p ... lExecution
Command1 && (CommandBlock2 & REM) || (CommandBlock3)
I assume that this would work as well
(Command1) && (SPECIAL CODE & REM) || (DEFAULT CODE)
What does not work for me is
(IF %A%==4 IF %B% NEQ 6) && (SPECIAL CODE & REM) || (DEFAULT CODE)
I am hoping that some-one knows a clever way of wrapping two conditionals as a (COMMAND1)
So far all I can think of is
Code: Select all
SET R=DEFAULT
IF %A%==4 IF %B% NEQ 6 SET R=SPECIAL
IF %R%==DEFAULT (DEFAULT CODE) ELSE (SPECIAL CODE)
Alan