(view source code of getram.bat as plain text)
@ECHO OFF
:: Enable command extensions and save initial environment
VERIFY OTHER 2>NUL
SETLOCAL ENABLEEXTENSIONS
IF ERRORLEVEL 1 (
ECHO Unable to enable command extensions
GOTO End
)
:: Check parameters
IF /I [%1]==[] SET SWITCH=/V
IF /I [%1]==[/Q] SET SWITCH=/S
IF /I [%1]==[/S] SET SWITCH=/S
IF /I [%1]==[/V] SET SWITCH=/V
IF [%SWITCH%]==[] GOTO Syntax
:: Use WINMSD.EXE to check the amount of RAM installed
START /W WINMSD.EXE /S
:: Read the amount of RAM installed from WINMSD's report
FOR /F "tokens=2 delims=: " %%A IN ('TYPE %COMPUTERNAME%.TXT ^| FIND "Total:" ^| FIND /V "\"') DO SET RAM=%%A
:: Delete WINMSD's report
DEL %COMPUTERNAME%.TXT
:: Add 1023 to round up, or
:: add 512 for "mathematical" rounding, or
:: add 0 (or "rem out" next line) to round down
SET /A RAM = %RAM:,=% + 1023
SET /A RAM = %RAM:,=% / 1024
:: Use switch to determine display format
IF [%SWITCH%]==[/S] (
ECHO %RAM%
) ELSE (
ECHO.
ECHO Total amount of RAM installed: %RAM% MB
)
GOTO End
:Syntax
ECHO.
ECHO GetRAM.bat, Version 1.10 for Windows NT
ECHO Displays the amount of RAM installed on this PC in MB
ECHO.
ECHO Idea: Mike Castle
ECHO Posted on alt.msdos.batch.nt, April 26, 2001
ECHO Extended by Rob van der Woude
ECHO http://www.robvanderwoude.com
ECHO.
ECHO Usage: %~n0 [ /Q ^| /S ^| /V ]
ECHO.
ECHO Switches: /Q ^(quiet^) and /S ^(silent^) display the amount of RAM
ECHO installed on the computer as a number only
ECHO /V ^(verbose^) also tells what it is displaying ^(default^)
ECHO.
ECHO This batch file uses NT's native WINMSD.EXE to check the amount of
ECHO RAM installed.
ECHO If you find it too slow and you have a copy of the Windows NT
ECHO Resource Kit you can use MEMORY.BAT instead.
ECHO MEMORY.BAT uses PSTAT.EXE to check the amount of RAM installed,
ECHO which is a lot faster.
ECHO MEMORY.BAT is available at http://www.robvanderwoude.com too.
:End
ENDLOCAL
page last modified: 2024-04-16; loaded in 0.0069 seconds