I have a script that calculates disk space in bytes. I have found a way to convert it to megabytes. I have just run it and i got a this: 1867.603187561035
. Is there
If you just want get the number before the .
:
@echo off
set $value=1867.703187561035
for /f "tokens=1 delims=." %%a in ('echo %$Value%') do set %$number%=%%a
echo %$Number%
And if you really want to test the second part of the number :
@echo off
setlocal EnableDelayedExpansion
set $value=1867.703187561035
for /f "tokens=1,2 delims=." %%a in ('echo %$Value%') do (
set $Number=%%a
set $Vtest=%%b
if "!$Vtest:~0,1!" geq "5" set /a $Number+=1
)
echo !$Number!