In Linux we can:
grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'
What are the alternatives in Windows command prompt and PowerShell? I will run this command from ruby.
I have tried using:
wmic memorychip get /VALUE | findstr "Capacity"
to get the prefixed output of available bytes. But I need to get only numeric value out of it. And I could not find anything like sed in Windows.
(Get-WmiObject Win32_PhysicalMemory | measure-object Capacity -sum).sum/1gbwmic memorychip get /VALUE | findstr "Capacity"command giving me prefixed output of available bytes. But I need to get only numeric value out of it. And I could not find anything likesedin windows, so I could complete this one-liner.wmic memorychip get Capacity|find /I /V "y". Usefindorfindstrcommand, in this case the output should be the same