0

please I have

%V_Frame_Rate_cat% = 30000
%V_Frame_Rate_Denom% = 1001

simply I would like createa a new variable %division% that contains the result of 30000/10001 = 29,97002997002997

so %division% = 29,97002997002997

and another, called %division2% = 29.97002997002997 (difference is "." in place of ",")

and another, called %division3% = 29.97

How can I do? thanks

1 Answers1

0

Updated Answer

If you want to put the results of the script into variables, you can do this:

setlocal ENABLEDELAYEDEXPANSION
set count=1
FOR /F "tokens=* USEBACKQ" %%F IN (`cscript /nologo go.vbs 30000 1001`) DO (
  set var!count!=%%F
  set /a count=!count!+1
)
echo %var1%
echo %var2%
echo %var3%
endlocal

Original Answer

This might help.

Numerator = WScript.Arguments(0)
Denom = WScript.Arguments(1)
Result=Numerator/Denom                ' Simple floating point division
WScript.Echo Result
Result=Replace(Result,".",",")        ' Replace decimal point with comma
WScript.Echo Result
Result=Round(Numerator/Denom,2)       ' Round result to two decimal places
WScript.Echo Result

Save it as go.vbs then do

cscript /nologo go.vbs 30000 1001

29.97002997003
29,97002997003
29.97
Mark Setchell
  • 191,897
  • 31
  • 273
  • 432