(view source code of memory.bat as plain text)
@ECHO OFF
IF [%1]==[] GOTO Begin
ECHO.
ECHO Memory.bat, Version 1.01 for NT 4 with Resource Kit
ECHO Displays the amount of RAM installed on this PC in MB
ECHO.
ECHO Written by Rob van der Woude
ECHO http://www.robvanderwoude.com
ECHO.
ECHO Use GETRAM.BAT instead if you do not have a copy of the Windows
ECHO NT Resource Kit available.
ECHO GETRAM.BAT is based on an idea posted on alt.msdos.batch.nt by
ECHO Mike Castle. It uses NT's native WINMSD.EXE instead of PSTAT.EXE
ECHO from the Resource Kit. However, it is much slower than this batch
ECHO file.
ECHO GETRAM.BAT is available at http://www.robvanderwoude.com too.
ECHO.
ECHO Total installed RAM in MB:
:Begin
:: Use PSTAT.EXE from the NT 4 Resource Kit
:: to find the amount of RAM installed (in KB)
FOR /F "tokens=2 delims=K " %%A IN ('PSTAT ^| FIND "Memory:"') DO SET RAM=%%A
:: The following command line is added to round up instead of down;
:: change the value from 1023 to 512 for "mathematical" rounding,
:: or remove the line to round down
SET /A RAM = %RAM% + 1023
:: Convert from KiloBytes to MegaBytes
SET /A RAM = %RAM% / 1024
:: Display the result
ECHO.%RAM%
page last modified: 2024-04-16; loaded in 0.0076 seconds