So I think I have this correct but for some reason it's not reading from the output file "ram.dat". Can anyone find the error in this?
@echo off
set percent=90
:ramcalc
cls
if %percent% GTR 90 Echo Needs To Be Less Than 90
if %percent% LSS 1 Echo Needs To Be Greater Than 1
echo Type Percent Of Ram To Calculate
set /p percent=1-90:
if %percent% GTR 90 goto ramcalc
if %percent% LSS 1 goto ramcalc
cls Calculating...
setlocal ENABLEDELAYEDEXPANSION
set vidx=0
for /F "tokens=*" %%A in (ram.dat) do (
SET /A vidx=!vidx! + 1
set var!vidx!=%%A
echo %%A
)
set var > test.txt
calc %var2%+%var3%+%var4%+%var5% >tmp
set /p add= < tmp
del tmp
calc %add%/1000000 >tmp
set /p divide= < tmp
del tmp
calc %divide%*0.%percent% >tmp
set /p ram= < tmp
del tmp
set /a round=%ram%+0
set ram=%round%
calc %ram%/1024 >tmp
set /p gb= < tmp
del tmp
set /a ramb=%gb%+0
cls
echo %percent% Rounded Is %ram%MB Approxamatly %ramb%GB
pause
goto ramcalc
I'm going to be using this in a dynamic memory modification and it is just a modified sample of my code.