如何从Windows命令行检索可用的RAM?

Mik*_*ike 30 windows command-line cmd

Windows或第三方程序中是否有可以检索计算机上可用RAM的命令行实用程序?(因为我不相信这可以在纯JAVA中完成,因为它在虚拟机中运行,具有预设/分配的RAM)?

dig*_*ire 40

systeminfo 是一个输出系统信息的命令,包括可用内存


小智 30

wmic OS get FreePhysicalMemory /Value
Run Code Online (Sandbox Code Playgroud)


PA.*_*PA. 20

使用wmic computersystem get TotalPhysicalMemory.例如:

C:\>wmic computersystem get TotalPhysicalMemory
TotalPhysicalMemory
4294500352
Run Code Online (Sandbox Code Playgroud)


Pet*_*rey 9

SysSnternals提供了大量有用的低级工具.

并且psinfo可能是最有用的.

我使用了以下psinfo开关:

-h        Show installed hotfixes.
-d        Show disk volume information.
Run Code Online (Sandbox Code Playgroud)

示例输出是这样的:

c:> psinfo \\development -h -d

PsInfo v1.6 - local and remote system information viewer
Copyright (C) 2001-2004 Mark Russinovich
Sysinternals - www.sysinternals.com


System information for \\DEVELOPMENT:
Uptime: 28 days, 0 hours, 15 minutes, 12 seconds
Kernel version: Microsoft Windows XP, Multiprocessor Free
Product type Professional
Product version: 5.1
Service pack: 0
Kernel build number: 2600
Registered organization: Sysinternals
Registered owner: Mark Russinovich
Install date: 1/2/2002, 5:29:21 PM
Activation status: Activated
IE version: 6.0000
System root: C:\WINDOWS
Processors: 2
Processor speed: 1.0 GHz
Processor type: Intel Pentium III
Physical memory: 1024 MB
Volume Type Format Label Size Free Free
A: Removable 0%
C: Fixed NTFS WINXP 7.8 GB 1.3 GB 16%
D: Fixed NTFS DEV 10.7 GB 809.7 MB 7%
E: Fixed NTFS SRC 4.5 GB 1.8 GB 41%
F: Fixed NTFS MSDN 2.4 GB 587.5 MB 24%
G: Fixed NTFS GAMES 8.0 GB 1.0 GB 13%
H: CD-ROM CDFS JEDIOUTCAST 633.6 MB 0%
I: CD-ROM 0% Q: Remote 0%
T: Fixed NTFS Test 502.0 MB 496.7 MB 99%
OS Hot Fix Installed
Q147222 1/2/2002
Q309521 1/4/2002
Q311889 1/4/2002
Q313484 1/4/2002
Q314147 3/6/2002
Q314862 3/13/2002
Q315000 1/8/2002
Q315403 3/13/2002
Q317277 3/20/2002
Run Code Online (Sandbox Code Playgroud)


noo*_*and 9

wmic OS get TotalVisibleMemorySize /Value
Run Code Online (Sandbox Code Playgroud)

注意不要TotalPhysicalMemory像其他地方一样


小智 6

有点旧,但我想知道类似的.刚刚添加我自IMO以来遇到的解决方案,最好的答案来自Everardo w/Physical Memory

wmic OS get FreePhysicalMemory /Value

这让我更深入地了解wmic ...请记住,Free Physical Memory不是要看的类型.

wmic OS get FreePhysicalMemory,FreeVirtualMemory,FreeSpaceInPagingFiles /VALUE

这会返回类似......

FreePhysicalMemory=2083440
FreeSpaceInPagingFiles=3636128
FreeVirtualMemory=842124
Run Code Online (Sandbox Code Playgroud)


小智 5

PS C:\Users\Rack> systeminfo | findstr "System Memory"
System Boot Time:          5/5/2016, 11:10:41 PM
System Manufacturer:       VMware, Inc.
System Model:              VMware Virtual Platform
System Type:               x64-based PC
System Directory:          C:\Windows\system32
System Locale:             en-us;English (United States)
Total Physical Memory:     40,959 MB
Available Physical Memory: 36,311 MB
Virtual Memory: Max Size:  45,054 MB
Virtual Memory: Available: 41,390 MB
Virtual Memory: In Use:    3,664 MB
Run Code Online (Sandbox Code Playgroud)