Is there a command to find out the available memory in Windows?

26

6

I am looking for a command that returns the available physical memory in Windows. I tried "systeminfo" but it takes too long and returns a lot of unnessesary information for me. If there is not any command for this what would be the best way to obtain it in a different way using command prompt?

Hakan

Posted 2011-07-26T10:48:53.263

Reputation: 361

@Mat 941kB in XMS memory, ha ha :-D – Tomas – 2016-05-29T17:26:21.930

1For a laugh you can type mem in a cmd shell, but that won't get you very far :-) – Mat – 2011-07-26T11:00:11.747

1What version of windows? – EBGreen – 2011-07-26T14:26:17.103

Answers

37

It takes some time (around 10 seconds for me) but the following command will do it:

systeminfo |find "Available Physical Memory"

Mehper C. Palavuzlar

Posted 2011-07-26T10:48:53.263

Reputation: 51 093

if you just 'find "Memory"' instead it gives a quick overview of all of it. Total, Available, Virtual: Available, Virtual: In Use – PsychoData – 2014-10-24T13:20:06.237

1Way too slow... highly not recommended. To show memory it needs to scan entire system. – majkinetor – 2015-03-09T10:17:06.283

5Note that this depends on your OS language. My above example works for English OSes. For example, for a Turkish OS, the following command line should be used: systeminfo |find "Kullanılabilir Fiziksel Bellek" – Mehper C. Palavuzlar – 2011-07-26T11:32:51.233

1This is an example from my PC showing a screeny of the outcome. – Mehper C. Palavuzlar – 2011-07-26T11:37:07.750

12

This will do it without taking 10 secs. Try this:

For Total Physical Memory

wmic ComputerSystem get TotalPhysicalMemory

For Available Physical Memory:

wmic OS get FreePhysicalMemory

Waqar

Posted 2011-07-26T10:48:53.263

Reputation: 121

10

Well if you are on Windows 7, you can use this at the powershell prompt:

(Get-WMIObject Win32_PhysicalMemory |  Measure-Object Capacity -Sum).sum

Or if you want a nice pretty how many gigs is it:

(Get-WMIObject Win32_PhysicalMemory |  Measure-Object Capacity -Sum).sum/1GB

Or if you are on an older version of windows (or W7 for that matter) at the command prompt:

wmic memorychip get capacity

EBGreen

Posted 2011-07-26T10:48:53.263

Reputation: 7 834

It's worth noting that whilst msinfo32 is usable by non-administrators for this purpose, wmic is not. – JdeBP – 2011-07-26T14:54:02.147

2I think that might be a policy issue. I just ran the wmic command just fine as a non-admin. – EBGreen – 2011-07-26T15:08:17.440

No, it's not a policy issue. It fails on non-domain machines as well. The message that you'll see as a non-administrator is Only the administrator group members can use WMIC.EXE.. – JdeBP – 2011-07-26T15:48:30.930

3Well, I'm not an admin and I did not see that message. Instead I saw the capacity of the two memory sticks installed on that machine. – EBGreen – 2011-07-26T15:59:04.183

3Just checked to be sure and the user ID I was logged in with is not a member of the local Administrators group, nor is it a member of any of the AD groups that are local admins. – EBGreen – 2011-07-26T16:05:17.797

+1 because this command worked for me too (and I didn't have to be logged in as an Administrator either, although this really isn't an issue anyway because the original questioner didn't specify it as a requirement). – Randolf Richardson – 2011-08-07T23:46:19.863

6

How about

typeperf "\Memory\Available Bytes"

in cmd or powershell prompt? You can find other monitoring instances with the command

typeperf -qx "\Memory"

Ahreum Lee

Posted 2011-07-26T10:48:53.263

Reputation: 61

1Note that the performance counter names are language dependent. Therefore on a non-english system the presented commands will fail. – Robert – 2016-12-09T13:14:29.347

3

You already know about systeminfo, as per the question. And as Mat noted in a comment, the mem command doesn't tell you what you want to know.

JP Software's TCC/LE has the built-in MEMORY command, which operates thus:

[C:\]memory

           30 % Memory load

  3,471,441,920 bytes total physical RAM
  2,428,456,960 bytes available physical RAM

  5,440,962,560 bytes total page file
  4,505,726,976 bytes available page file

  2,147,352,576 bytes total virtual RAM
  2,053,435,392 bytes available virtual RAM

        262,144 characters total alias
        262,143 characters free

         20,480 characters total history

[C:\]

It also has the @WINMEMORY[] variable function, which can be used in various ways:

[C:\]echo There are %@COMMA[%@WINMEMORY[2]] available bytes physical RAM.
There are 2,456,285,184 available bytes physical RAM.

[C:\]

Bundled with Windows comes the msinfo32 command, whose output can be restricted more narrowly than that of systeminfo:

msinfo32 /categories +systemsummary

There are a whole load of other utilities, from various people, that can report the same information.

JdeBP

Posted 2011-07-26T10:48:53.263

Reputation: 23 855