VideoHelp Forum
+ Reply to Thread
Results 1 to 9 of 9
Thread
  1. 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

    Code:
    if "%V_Height%" GEQ "720" (Set "HDformat=1")
    seems recognize when %V_Height%=720, but don't set HDformat=1 also when %V_Height%=1080.

    Now: 1080 is greater (or no?^^) than 720... so why the HDformat don't assume "1"?





    thanks
    Last edited by marcorocchini; 29th Sep 2014 at 04:36.
    Quote Quote  
  2. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    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.
    Quote Quote  
  3. Originally Posted by ndjamena View Post
    Lose the double quotes, otherwise they're compared as strings and 7 is more than 1.



    Name:  OHMYC.JPG
Views: 304
Size:  28.0 KB

    ahnn, thanks
    Last edited by marcorocchini; 29th Sep 2014 at 15:11.
    Quote Quote  
  4. 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 ....
    Quote Quote  
  5. Originally Posted by marcorocchini View Post
    Now: 1080 is greater (or no?^^) than 720... so why the HDformat don't assume "1"?[/B]
    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.
    Quote Quote  
  6. yes I understand, and the OR command: maybe it don'exist jet in windows 8.1?
    Quote Quote  
  7. 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.
    Quote Quote  
  8. 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 (
        ...
      )
    )
    that site is a good source for codes, you do not have to have that else there ...
    Quote Quote  
  9. ahn mmmmm I keep in mind ^^

    Click image for larger version

Name:	ccat6.gif
Views:	226
Size:	486.2 KB
ID:	27779
    Quote Quote  
Visit our sponsor! Try DVDFab and backup Blu-rays!