mercredi 29 avril 2015

Batch file problems with IF statements and parantheses

I am trying to batch start some experiments. I need to redo some of them but not all. The ones where (s==1000 and r==0.5 and (c==1 or c==25 or c==75)) have been done ok so can be skipped (they take a long time to run). Ever since I introduced the IF statements, the way the parentheses are parsed is giving errors. I keep getting unexpected ( or ). I've tried rewriting the whole thing, but to no avail.

I know this is a lot like a 'please check my code for bugs' question, but I am really at my wits end here.

SET dotest=1
FOR %%s IN (1000,2000) do (
    FOR %%r IN (0.5,0.75,1) do (
        FOR %%c IN (1,25,75,100) do (
            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!"
            )
        )
    )
)

Aucun commentaire:

Enregistrer un commentaire