Hi cats,
because seems to me cannot work the simple "OR" in a batch, I wonder:
supposing defined %variableA% and the %variableB%
if "%variableA%"=="1" OR if "%variableB%"=="1" --> execute ....
How is the correct way to use the OR command?
OR command acts also in the case one of the 2 variable are not defined?
PLease I should have another questions:
I have to tell to the batch
IF the %V_Height% value is greater or equal 720 ---> set the HD format switch =1
This
seems recognize when %V_Height%=720, but don't set HDformat=1 also when %V_Height%=1080.Code:if "%V_Height%" GEQ "720" (Set "HDformat=1")
Now: 1080 is greater (or no?^^) than 720... so why the HDformat don't assume "1"?
thanks
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 9 of 9
Thread
-
Last edited by marcorocchini; 29th Sep 2014 at 04:36.
-
Lose the double quotes, otherwise they're compared as strings and 7 is more than 1.
-edit- You might want to check if V_Height is empty first.Last edited by ndjamena; 29th Sep 2014 at 06:59.
-
-
you can make these two lines to perform IF OR IF execute something:
if "%variableA%"=="1" --> execute ....
if "%variableB%"=="1" if not "%variableA%"=="1" --> execute .... -
Because of the way the character value of the string is parsed, the position of the character matters i.e.
1080 is smaller than
720 because 1 is less than 7
1080 is greater than 0720
Edit: Just noticed ndjamena's post, he's totally right about comparing pure decimal numbers.Last edited by nic2k4; 29th Sep 2014 at 21:47.
-
yes I understand, and the OR command: maybe it don'exist jet in windows 8.1?
-
Sorry, it's just that Al gave you the answer. There is no OR command in CMD or COMMAND, it is implied in the way you sequence the commands in your batch file.
-
for batch problems I always use search engines, two words first "windows batch" following shortly what you want, possibly including command, it mostly brings you to stackoverflow.com, like in this case "windows batch if or" , where duckduckgo for example gives this as first option. Using some kind of switch for IF OR scenario (if "your execute" is long or more complex)
Code:FOR ..... DO ( set "TRUE=" IF cond1 set TRUE=1 IF cond2 set TRUE=1 IF defined TRUE ( ... ) else ( ... ) )