Batch decimal variable calculator -
i working on game in batch script , in 1 place, need make multiplication of decimals. problem is, end result 0.
this code:
@echo off echo calcultating new values echo ... ping localhost -n 2 >nul set /p coal_price_buy_brt=<coal_price_buy_brt.wss set /p coal_ind_buy=<coal_ind_buy.wss cls echo first values : echo ################################ echo ## coal price brutto ## %coal_price_buy_brt% ## echo ################################ echo ## coal index buy ## %coal_ind_buy% ## echo ################################ ping localhost -n 3 >nul echo %coal_price_buy_brt% echo %coal_ind_buy% set enabledelayedexpansion=coal_price_buy_net set /p coal_price_buy_net=<calc %coal_price_buy_brt%*%coal_ind_buy% echo complete table : echo ################################ echo ## coal price brutto ## %coal_price_buy_brt% ## echo ################################ echo ## coal index buy ## %coal_ind_buy% ## echo ################################ echo ## coal price netto ## %coal_price_buy_net% ## echo ################################
the file data are:
coal_price_buy_brt = 150 coal_ind_buy = 0.84
edit : 4 years after post, i'm in studies , realize there difference between integers , floats in coding... having helped me !
you can call batch file mathematical evaluation.
name vbs.bat , use call vbs 150*0.84
, result in variable called %val%
@echo off >"%temp%\vbs.vbs" echo set fso = createobject("scripting.filesystemobject") : wscript.echo (%*) /f "delims=" %%a in ('cscript /nologo "%temp%\vbs.vbs"') set "val=%%a" del "%temp%\vbs.vbs"
Comments
Post a Comment