如何使用 Windows cmd 获取总物理内存

How can I get total physical memory using Windows cmd

我查询了 typeperf 计数器和实例,但找不到有关总内存的任何信息。我只找到

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

添加它们的任意组合与任务管理器中的总内存不匹配。

我也试过了

    systeminfo | findstr /C:"Total Physical Memory"

但这只适用于英语模式 (chcp 437)。我不是美国人,为不同国家制作节目。。最重要的是,这需要很长时间。

拜托,有人知道只用 cmd 获得 Windows 中的总内存的好主意吗?或者请解释一下内存的关系,以便我可以从 typeperf 查询中计算出总内存..

试试这个

wmic memorychip get capacity

Viktar 的回答 (wmic memorychip get capacity) 为您提供了每个 Dimm 的容量(如果您只安装了一个 Dimm,则可以正常工作,但如果安装了多个 Dimm,则每个 Dimm 会给出一个值)。要获取总内存大小,请使用:

wmic computersystem get TotalPhysicalMemory

如何获得总物理内存

使用以下命令:

wmic ComputerSystem get TotalPhysicalMemory

示例输出:

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

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