Display the amount of RAM installed

Windows NT 4/2000 only

Mike Castle posted the following interesting solution to display the amount of physical memory in NT.
It uses native NT commands only.

In article <9c94nn$n54$1@news.kolumbus.fi>,
Petri Paunonen <petri.paunonen@brandtgroup.fi> wrote:
>How could I dump the memsize of ram in simple form to a text file ?
@echo off
winmsd /s
for /f "tokens=2" %%v in ('findstr /r "^...Total:" %COMPUTERNAME%.txt') do set mem=%%v
del %COMPUTERNAME%.txt
for /f %%v in ('set /a %mem:,=% / 1024') do set mem=%%v
echo %mem%
--
Mike Castle Life is like a clock: You can work constantly
dalgoda@ix.netcom.com and be right all the time, or not work at all
www.netcom.com/~dalgoda/ and be right at least twice a day. -- mrc
We are all of us living in the shadow of Manhattan. -- Watchmen

The result was Memory.bat. It is much faster (PSTAT.EXE does
not check hard disks, as WINMSD.EXE does), it does require the
NT Resource Kit, whereas
GetRAM.BAT uses native NT commands only.

@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%