Using "set /a" statements in Windows batch file...

Hello all,<br /><br />I am trying to write a short batch file that will change a few variables each time it loops. I am just having a lot of trouble with the "set /a" assignment statements. If someone could please outline the correct syntax for the set statement and/or suggest how I could correct my code it would be greatly appreciated...<br /><br />Thanks, Nathan<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><br />rem echo off<br />set mFourMIN=0.0<br />set mFourMAX=3.0<br />rem set umMIN=0.0<br />rem set umMAX=1.0<br />rem set phiMIN=0.0<br />rem set phiMAX=10<br /><br />set mFour=0.0<br /><br />FOR /L %%G IN (%mFourMIN%,1,%mFourMAX%) DO (<br />    echo mFour = %mFour%<br />        <br />    <br />    rem SET um=1<br />    rem SET phi=10<br /><br />    SET /a tope = %mFour% - 1<br />    SET /a tope = %tope% * 9<br />    SET /a bote = %mFour% + 1<br />    SET /a bote = %bote% * 10<br />    SET /a e = tope / bote<br />    echo e = %e%<br /><br />    echo e = %e%<br />    rem set outFile="e%e%_umass%um%_phi%phi%.d"<br />    rem echo outFile = %outFile%<br />    rem ..\..\gawk\gawk "BEGIN { ORS = \"\n\";  } {if (NR == 7) { print \"\tmFourVal=%mFour%\" >> \"tmpsetupFile\"; next } if (NR == 8) { print \"\tumassVal=%um%\" >> \"tmpsetupFile\"; next } if (NR == 9) { print \"\tphiVal=%phi%\" >> \"tmpsetupFile\"; next } else { print $0 >> \"tmpsetupFile\" } }" setupFile<br />     <br />    rem ..\..\gawk\gawk -f tmpsetupFile source.d<br />    SET /a mFour= %mFour% + 1<br />    echo.<br />)<br />PAUSE<br /><!--c2--></div><!--ec2--><br /><br /><span class='edit'>This post has been edited by <b>enpey</b>: 13 Jan, 2008 - 09:41 PM</span>
</div>
 
Top