@echo off set /p line= for /f "tokens=1-3 delims=, " %%x in ("%line%") do ( set /a j=%%x set /a k=%%y set /a l=%%z echo %%x echo %%y echo %%z echo end ) for /f "tokens=4-6 delims= " %%x in ("%line%") do ( set /a a=%%x - %j% set /a b=%%y - %k% set /a c=%%z - %l% ) for /f "tokens=7-9 delims= " %%x in ("%line%") do ( set /a d=%%x - %j% set /a e=%%y - %k% set /a f=%%z - %l% ) for /f "tokens=10-12 delims= " %%x in ("%line%") do ( set /a g=%%x - %j% set /a h=%%y - %k% set /a i=%%z - %l% ) set /a v=(%a%*%e%*%i%+%b%*%f%*%g%+%c%*%d%*%h%-%a%*%h%*%f%-%b%*%i%*%d%-%c%*%g%*%e%)/6 echo %v%