Batch file problems with IF statements and parantheses -


i trying batch start experiments. need redo of them not all. ones (s==1000 , r==0.5 , (c==1 or c==25 or c==75)) have been done ok can skipped (they take long time run). ever since introduced if statements, way parentheses parsed giving errors. keep getting unexpected ( or ). i've tried rewriting whole thing, no avail.

i know lot 'please check code bugs' question, @ wits end here.

set dotest=1 %%s in (1000,2000) (     %%r in (0.5,0.75,1) (         %%c in (1,25,75,100) (             if (%%s==1000) (                 if (%%r==0.5) (                     if (%%c==1)                         (set dotest==0)                     if (%%c==25)                         (set dotest==0)                     if (%%c==75)                         (set dotest==0)                 )             )             if (%%dotest==1) (                 echo "hello world!"             )         )     ) ) 

@echo off  setlocal enabledelayedexpansion %%s in (1000,2000) (     %%r in (0.5,0.75,1) (         %%c in (1,25,75,100) (             set dotest=1             if %%s == 1000 (                 if %%r == 0.5  (                     if %%c == 1 (                        set dotest=0                     )                     if %%c==25 (                         set dotest=0                     )                     if %%c==75 (                         set dotest=0                     )                 )             )             if !dotest! == 1 (                 echo "hello world^!" %%s,%%r,%%c             )         )     ) ) 

you should able run without syntax errors - there's no way me know if logic correct.the issues example:

  1. if conditions defined without brackets
  2. start brackets context after if on same line
  3. if change dotest value within brackets , need again in brackets content you'll need delayed expansion , ! instead of %
  4. in set command use 1 equal sign

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -