I have batch file and When user Writes number,Then automatically Adds numbers together. But if the User Writes Decimal number,Cmd Can not calculate.
Any idea?
Thanks in advance.
I have batch file and When user Writes number,Then automatically Adds numbers together. But if the User Writes Decimal number,Cmd Can not calculate.
Any idea?
Thanks in advance.
Here is batch/vbscript hybrid.
The batch passes the arguments and parses the result and stores it in the variable
Result
There is one invisible char following the
::'
(I hope they get transferred)Some examples where the batch file is stored as
Math.cmd
(my locale setting has a decimal comma)Try This :
Pure batch only supports 32bit integers, you therefore have to make some changes to make it work which is not difficult, but is is a slightly larger script. Instead use a combination of
vbscript
andbatch
. Create a file and name it something likeMyCalc.cmd
and paste the below into it:To use it, open
cmd.exe
cd to where the file you saved is, then runMyCalc.cmd 10*0.5
orMyCalc.cmd 8.2/0.5
orMyCalc.cmd 3.2-0.3
orMyCalc.cmd 10+9.5
etc.Alternatively, add the path to the script to the system's
PATH
environmental and you do not have tocd
to it, or just call it straight from cmdline asd:\path to file\scripts\MyBat.cmd 10+2.3
etc.This solution is one provided from an earlier post here
for example: