简体   繁体   中英

How can I get total physical memory using Windows cmd

I inquired typeperf counters and instances, but couldn't find anything about the total memory. I only found

    \Memory\Availble Bytes
    \Memory\Cache Bytes
    \Process\Private Bytes
    \Process\Working Set

and adding any combination of them didn't match the total memory in task manager.

I also tried

    systeminfo | findstr /C:"Total Physical Memory"

but this only worked in english mode(chcp 437). I am not an American and making program for various countries.. and above all, this takes too long time.

Please, anyone know good idea to get total memory in Windows with only cmd? Or please explain me the relation of memories so that I can calculate the total memory from typeperf queries..

How can I get total physical memory

Use the following command:

wmic ComputerSystem get TotalPhysicalMemory

Example output:

TotalPhysicalMemory
4275273728

Total Physical Memory

 wmic ComputerSystem get TotalPhysicalMemory 

Available Physical Memory

 wmic OS get FreePhysicalMemory 

Virtual Memory Max Size

 wmic OS get TotalVirtualMemorySize 

Virtual Memory Available

 wmic OS get FreeVirtualMemory 

You can combine them as follows into one command:

 wmic ComputerSystem get TotalPhysicalMemory && wmic OS get FreePhysicalMemory,TotalVirtualMemorySize,FreeVirtualMemory 

Source SuperUser answer What's the equivalent command of “wmic memlogical” in Windows 7? by 8088

Viktar's answer ( wmic memorychip get capacity ) gives you the capacity of each Dimm (which will work fine, if you have only one Dimm installed but gives you one value per Dimm if there is installed more than one). To get the size of total memory use:

wmic computersystem get TotalPhysicalMemory

尝试这个

wmic memorychip get capacity

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM