Retrieve details of installed Memory Chips using @WMI

#1
Code:
c:\users\jlc\utils>ver

TCC  23.00.28 x64   Windows 7 [Version 6.1.7601]
Code:
@setlocal
@echo off
function StrFormatByteSize=`%@winapi[shlwapi.dll,StrFormatByteSize,%1,BUFFER,256]`
set MemoryDevices=%@wmi[root\cimv2,"SELECT MemoryDevices From Win32_PhysicalMemoryArray"]

do kount=1 to %MemoryDevices
  set Tag=%@wmi[root\cimv2,"SELECT Tag From Win32_PhysicalMemory",%kount]
  set Capacity=%@wmi[root\cimv2,"SELECT Capacity From Win32_PhysicalMemory",%kount]
  set DeviceLocator=%@wmi[root\cimv2,"SELECT DeviceLocator From Win32_PhysicalMemory",%kount]
  set Manufacturer=%@wmi[root\cimv2,"SELECT Manufacturer From Win32_PhysicalMemory",%kount]
  echo Tag          : %Tag
  echo DeviceLocator: %DeviceLocator
  echo Capacity     : %@StrFormatByteSize[%Capacity]
  echo Manufacturer : %Manufacturer
  echo --------------------------------
enddo

endlocal
quit

Tag          : Physical Memory 0
DeviceLocator: DIMM3
Capacity     : 4.00 GB
Manufacturer : Samsung
--------------------------------
Tag          : Physical Memory 1
DeviceLocator: DIMM1
Capacity     : 4.00 GB
Manufacturer : Samsung
--------------------------------
Tag          : Physical Memory 2
DeviceLocator: DIMM4
Capacity     : 4.00 GB
Manufacturer : Samsung
--------------------------------
Tag          : Physical Memory 3
DeviceLocator: DIMM2
Capacity     : 4.00 GB
Manufacturer : Samsung
--------------------------------
Joe