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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29249830/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 19:00:33  来源:igfitidea点击:

How can I get total physical memory using Windows cmd

windowsmemorycmd

提问by Ahreum Lee

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

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

    \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.

但这仅适用于英文模式(chcp 437)。我不是美国人,正在为各个国家/地区制定计划……最重要的是,这需要很长时间。

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..

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

回答by DavidPostill

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

总物理内存

wmic ComputerSystem get TotalPhysicalMemory

可用物理内存

wmic OS get FreePhysicalMemory

虚拟内存最大大小

wmic OS get TotalVirtualMemorySize

可用虚拟内存

wmic OS get FreeVirtualMemory

您可以按如下方式将它们组合成一个命令:

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

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

Source SuperUseranswer Windows 7 中“wmic memlogical”的等效命令是什么?8088

回答by Stephan

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:

Viktar 的答案 ( wmic memorychip get capacity) 为您提供了每个 Dimm 的容量(如果您只安装了一个 Dimm,这将正常工作,但如果安装了多个 Dimm,则为每个 Dimm 提供一个值)。要获得总内存使用的大小:

wmic computersystem get TotalPhysicalMemory

回答by Viktar Tserashchuk

Try this

尝试这个

wmic memorychip get capacity