I have a batch program with below code segment inside it.
While executing, I can see the whole IF () statement [ending with line 20 with all 3 ')'s ] getting called first, as a single line.
It does execute the inner for loop also without issues. During the for loop iterations, I see the the block in line 3 after 'do' starting from '(' and ending with line 19 [ ending with two ')'s ] getting called.
But after this, it stops and issues an error ) was unexpected at this time.
I think after the for loop instead of resuming from line 21, it goes to line 20 and mistakes the ')' for an unmatched one.
Am I doing something wrong in this code? Is it the way the line breaks, or format/tabs causing the issues?
`
1 IF NOT "%2"=="/d" (
2 cmd1
3 for /F "tokens=1-2 delims=, " %%A in (!Input_File!) do (
4 set objName=%%A
5 set objType=%%B
6 cmd2
7 REM comment1
8 if "!objType!"=="mapping" (
9 REM comment2
10 cmd3 arg1 arg2 arg3 arg4 arg 5 longarg6^
11 longarg7 longarg8
12 cmd4
13 )
14 IF ERRORLEVEL 1 (
15 REM comment3
16 echo "FAILED: One or more steps returned >1 "
17 GOTO ENDOFBATCH
18 )
19 )
20 )
`
Aucun commentaire:
Enregistrer un commentaire