How to retrieve available RAM from Windows command line?

前端 未结 11 672
-上瘾入骨i
-上瘾入骨i 2020-12-23 09:44

Is there a command line utility within Windows or third-party program that can retrieve available RAM on a machine? (Since I don\'t believe this can be done in pure JAVA, si

相关标签:
11条回答
  • 2020-12-23 10:40

    Use wmic computersystem get TotalPhysicalMemory. E.g.:

    C:\>wmic computersystem get TotalPhysicalMemory
    TotalPhysicalMemory
    4294500352
    
    0 讨论(0)
  • 2020-12-23 10:41

    systeminfo is a command that will output system information, including available memory

    0 讨论(0)
  • 2020-12-23 10:44
    wmic OS get TotalVisibleMemorySize /Value
    

    Note not TotalPhysicalMemory as suggested elsewhere

    0 讨论(0)
  • 2020-12-23 10:44

    Here is a pure Java solution actually:

    public static long getFreePhysicalMemory()
    {
        com.sun.management.OperatingSystemMXBean bean =
                (com.sun.management.OperatingSystemMXBean)
                        java.lang.management.ManagementFactory.getOperatingSystemMXBean();
        return bean.getFreePhysicalMemorySize();
    }
    
    0 讨论(0)
  • 2020-12-23 10:46

    Try MemLog. It does the job perfectly and quickly.

    Download via one of many mirrors, e.g. this one: SoftPedia page for MemLog.
    (MemLog's author has a web site. But this is down some times. Wayback machine snapshot here.)

    Example output:

    C:\>memlog
    2012/02/01,13:22:02,878956544,-1128333312,2136678400,2138578944,-17809408,2147352576
    

    878956544 being the free memory

    0 讨论(0)
提交回复
热议问题