I introduced CompInfo.exe freeware to display the following information about your computer:

  • Number of Processors, Processor Type and Speed
  • Operating System and Service Pack Version
  • Physical and Virtual Memory plus Memory Load
  • Network Card, MAC Address, IP, DNS, Gateway and WINs Addresses
  • Logical Drive information including Volume Size, Serial Number, Label and Free Bytes
  • Video Card Type
  • Hard Disk and CDROM Information
  • Installed Printers
I have scripted PSR.bat as an example of how to set a variable based upon information returned by CompInfo.exe.

The syntax for using PSR.bat is:

call PSR numb speed memory

Where:

<b>numb</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 number of processors.

<b>speed</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 the CPU speed in mHz.

<b>memory</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 amount of RAM in megabytes.
PSR.bat contains:
@echo off
if \{%3\}==\{\} @echo PSR numb speed memory&goto :EOF
setlocal ENABLEDELAYEDEXPANSION
set wrk="%TEMP%\info_%RANDOM%.TMP"
@echo Number of Processors Installed>%wrk%
@echo Processor 1 Speed>>%wrk%
@echo Installed Memory>>%wrk%
set /a numproc=0
set /a mhz=0
set /a ram=0
for /f "Tokens=1* Delims=:" %%a in ('compinfo^|findstr /i /g:%wrk%') do (
 set key=%%a
  for /f "Tokens=1" %%c in ('@echo %%b') do (
   if /i "!key:~1,4!" EQU "Numb" set /a numproc=%%c
   if /i "!key:~1,4!" EQU "Proc" set /a mhz=%%c
   if /i "!key:~1,4!" EQU "Inst" set /a ram=%%c  
 )
)
del /q %wrk%
endlocal&set /a %1=%numproc%&set /a %2=%mhz%&set /a %3=%ram%