1------------ Testing FOR loop ------------ 2--- Multiple lines 3A 4B 5C 6--- Lines and spaces 7D 8E 9F 10--- Multiple lines and commas 11G 12H 13I 14--- Multiple lines and %I 15%I 16%I 17%I 18--- Multiple lines and %j 19%j 20%j 21%j 22--- FOR /F token parsing 23 24 25 26?=_ @=` A=a B=b C=c D=d E=e F=f G=g H=h I=i J=j K=k L=l M=m N=n O=o P=p Q=q R=r S=s T=t U=u V=v W=w X=x Y=y Z=z [={ \=| ]=} ^= _= `=%` a=%a b=%b c=%c d=%d e=%e f=%f g=%g h=%h i=%i j=%j k=%k l=%l m=%m n=%n o=%o p=%p q=%q r=%r s=%s t=%t u=%u v=%v w=%w x=%x y=%y z=%z {=%{ |=%| }=%} ~=%~ 27 28?=_ @=` A=a B=b C=c D=d E=e F=f G=g H=h I=i J=j K=k L=l M=m N=n O=o P=p Q=q R=r S=s T=t U=u V=v W=w X=x Y=y Z=z [={ \=| ]=} ^= _= `= a= b= c= d= e= f= g= h= i= j= k= l= m= n= o= p= q= r= s= t= u= v= w= x= y= z= {= |= }=%} ~=%~ 29 30?=_ @=` A=a B=b C=c D=d E= F= G=%G H=%H I=%I J=%J K=%K L=%L M=%M N=%N O=%O P=%P Q=%Q R=%R S=%S T=%T U=%U V=%V W=%W X=%X Y=%Y Z=%Z [=%[ \=%\ ]=%] ^=%^ _=%_ `=%` a=%a b=%b c=%c d=%d e=%e f=%f g=%g h=%h i=%i j=%j k=%k l=%l m=%m n=%n o=%o p=%p q=%q r=%r s=%s t=%t u=%u v=%v w=%w x=%x y=%y z=%z {=%{ |=%| }=%} ~=%~ 31 32?=_ @=` A=a B=b C=c D=d E=e F=f G=g H=h I=i J=j K=k L=l M=m N=n O=o P=p Q=q R=r S=s t u v w x y z { | } ~ ? @ [ \ ] _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~ ? @ [ \ ] T= U= V= W= X= Y= Z= [= \= ]= ^= _=%_ `=%` a=%a b=%b c=%c d=%d e=%e f=%f g=%g h=%h i=%i j=%j k=%k l=%l m=%m n=%n o=%o p=%p q=%q r=%r s=%s t=%t u=%u v=%v w=%w x=%x y=%y z=%z {=%{ |=%| }=%} ~=%~ 33 34?=_ @=` A=a B=b C=c D=d E=%E F=%F G=%G H=%H I=%I J=%J K=%K L=%L M=%M N=%N O=%O P=%P Q=%Q R=%R S=%S T=%T U=%U V=%V W=%W X=%X Y=%Y Z=%Z [=%[ \=%\ ]=%] ^=%^ _=%_ `=%` a=%a b=%b c=%c d=%d e=%e f=%f g=%g h=%h i=%i j=%j k=%k l=%l m=%m n=%n o=%o p=%p q=%q r=%r s=%s t=%t u=%u v=%v w=%w x=%x y=%y z=%z {=%{ |=%| }=%} ~=%~ 35 36?=_ @=` A=a B=b C=c D=d E=e F=f G=g H=h I=%I J=%J K=%K L=%L M=%M N=%N O=%O P=%P Q=%Q R=%R S=%S T=%T U=%U V=%V W=%W X=%X Y=%Y Z=%Z [=%[ \=%\ ]=%] ^=%^ _=%_ `=%` a=%a b=%b c=%c d=%d e=%e f=%f g=%g h=%h i=%i j=%j k=%k l=%l m=%m n=%n o=%o p=%p q=%q r=%r s=%s t=%t u=%u v=%v w=%w x=%x y=%y z=%z {=%{ |=%| }=%} ~=%~ 37 38---------- Testing AND operator ---------- 39TRUE AND condition 40---------- Testing OR operator ----------- 41FALSE OR condition 42---------- Testing CMD exit codes and errorlevels ---------- 43--- CMD /C Direct EXIT call 44OK 45OK 46--- CMD /C Direct EXIT /B call 47OK 48OK 49--- CMD /C Non-existing command 50OK 51OK 52OK 53OK 54--- CMD /C RMDIR (no ERRORLEVEL set) 55OK 56OK 57OK 58OK 59--- CMD /C DIR (sets ERRORLEVEL) - With failure 60OK 61OK 62OK 63OK 64OK 65OK 66OK 67OK 68--- CMD /C DIR (sets ERRORLEVEL) - With success 69OK 70OK 71OK 72OK 73OK 74OK 75--- CALL Batch Non-existing command 76OK 77OK 78--- CALL Batch RMDIR (no ERRORLEVEL set) 79OK 80OK 81--- CALL Batch RMDIR with || (sets ERRORLEVEL) 82OK 83OK 84OK 85OK 86--- CALL Batch DIR (sets ERRORLEVEL) - With failure 87OK 88OK 89OK 90OK 91OK 92OK 93OK 94OK 95--- CALL Batch DIR (sets ERRORLEVEL) - With success 96OK 97OK 98OK 99OK 100OK 101OK 102OK 103OK 104---------- Testing ERRORLEVEL in .BAT and .CMD ---------- 105--- In .BAT file 1060 1071 1082 1092 1102 1112 1122 1132 1142 1151 1161 1171 1181 119--- In .CMD file 1200 1211 1222 1230 1240 1250 1260 1270 1280 1291 1300 1310 1320 133---------- Testing SET /A ERRORLEVELs ---------- 134--- Success 135OK 1360 1372 138--- Unbalanced parentheses 139OK 1401073750988 1412 142--- Missing operand 143OK 1441073750989 1452 146--- Syntax error 147OK 1481073750990 1497 150--- Invalid number 151OK 1521073750991 1537 154--- Number larger than 32-bits 155OK 1561073750992 1577 158--- Division by zero 159OK 1601073750993 1617 162--------- Finished -------------- 163