Using the free Pstat.exe, I have scripted memupsec.bat to return the physical memory in kilobytes, and the system uptime in seconds.

The syntax for using memupsec.bat is

memupsec memkb upsec

Where:

<b>memkb</b> is a <a href="/article/jsifaq/jsi-tip-5535-how-can-i-cause-a-called-batch-file-to-return-a-call-directed-environment-variable-.aspx">call directed numeric environment variable</a> that will contain the physical memory in kilobytes.

<b>upsec</b> is a <a href="/article/jsifaq/jsi-tip-5535-how-can-i-cause-a-called-batch-file-to-return-a-call-directed-environment-variable-.aspx">call directed numeric environment variable</a> that will contain the system up time in seconds.
memupsec.bat contains:
@echo Off
if \{%2\}==\{\} @echo Syntax memupsec memkb upsec&goto :EOF
setlocal ENABLEDELAYEDEXPANSION
for /f "Tokens=5,8,9" %%a in ('pstat^|find "Pstat version"') do (
 set /a mem=%%a
 set /a upsec=%%b * 86400
 for /f "Tokens=1-4 Delims=:." %%i in ('@echo %%c') do (
  set /a hr=100%%i%%100
  set /a min=100%%j%%100
  set /a sec=100%%k%%100
  set /a upsec=!upsec! + !hr! * 3600
  set /a upsec=!upsec! + !min! * 60
  set /a upsec=!upsec! + !sec!
  set /a hsec=1000%%l%%1000
  if !hsec! GEQ 500 set /a upsec=!upsec! + 1
 )
)
endlocal&set /a %1=%mem%&set /a %2=%upsec%