If I use these commands this way around, it does what it should:
If foo
was previously set as one thing or another, it skips to foobar_menu
If foo
was previously not set as (the same) one thing or another, it skips to another_menu
rem Check if foo was previously set as bar1 or bar2...
if "%foo%"=="bar1" goto :foobar_menu
if "%foo%"=="bar2" goto :foobar_menu
rem Check if foo was NOT previously set as bar1 or bar2...
if not "%foo%"=="bar1" goto :another_menu
if not "%foo%"=="bar2" goto :another_menu
Here's why it's confusing me - if I swap those around like shown below, then it doesn't work properly, it goes to the wrong label, but why?
rem Check if foo was NOT previously set as bar1 or bar2...
if not "%foo%"=="bar1" goto :another_menu
if not "%foo%"=="bar2" goto :another_menu
rem Check if foo was previously set as bar1 or bar2...
if "%foo%"=="bar1" goto :foobar_menu
if "%foo%"=="bar2" goto :foobar_menu
Why are these two things not doing the same thing?
Is this because I am not putting the goto parts in brackets?
I do have it working (the first way) but that's not the same order my menus go in and I just wanted it all running the way it's laid out in the 2nd (non-working) example above.
Cheers.
EDIT:
These are the actual commands. When put this way around, although nested, it's still going to the label choose_audio_sample_rate
even though opus or libopus is set under the variable.
if not "%audio_codec%"=="libopus" if not "%audio_codec%"=="opus" goto :choose_audio_sample_rate
if "%audio_codec%"=="libopus" if "%audio_codec%"=="opus" goto :choose_audio_sample_rate_opus
In fact, the swapped version also doesn't work, it also goes to choose_audio_sample_rate
even though opus or libopus is set under the variable.
if "%audio_codec%"=="libopus" if "%audio_codec%"=="opus" goto :choose_audio_sample_rate_opus
if not "%audio_codec%"=="libopus" if not "%audio_codec%"=="opus" goto :choose_audio_sample_rate
I'm turning into a lunatic here lol, OK it will just work (and pass straight to the non-opus menu) if I only use this:
if "%audio_codec%"=="libopus" (goto :choose_audio_sample_rate_opus)
if "%audio_codec%"=="opus" (goto :choose_audio_sample_rate_opus)
If it is libopus, it goes to the the right label. If it's not libopus, the next line gets processed and if it's opus, it goes to the the right label.
If it got beyond that, neither was libopus or opus and it carries on to the general menu.