DragonHeart000
DragonHeart000

Reputation: 1106

How to have a double in a batch file

I was trying to make a batch file that will have doubles instead of just integers. Maybe I am looking it up wrong or maybe it is just not possible but I could not find anything on this.

Here is what I tried to test it

@echo off
set /a test=1.5
echo %test%
set /a test=%test%+%test%
echo %test%
pause >nul

When I run this here is what I get:

Missing operator.
1
2

What I was expecting was 1.5 and then 3. By "Missing operator" I am presuming there is something I should do rather than /a but I don't know what it is.

Upvotes: 0

Views: 344

Answers (1)

Magoo
Magoo

Reputation: 80073

Batch maths in integer-only. set is expecting to perform a calculation, but since you can only use integers, it's objecting to . where it expects an operator, hence 'missing operator'

Upvotes: 1

Related Questions