How to find the RAM type in command prompt?

587,842

Solution 1

You can use the wmic command to find out the information about your memory:

wmic MemoryChip get BankLabel, Capacity, MemoryType, TypeDetail, Speed

The MemoryType returns the type of your Memory: 21=DDR-2 etc. Here is a complete list of information you can get from the MemoryChip Class.

In my case unfortunately the type is unknown (0), but I still get some useful information:

wmic output

Solution 2

There is software out there that gathers information on some of the main devices of your system.

These program will display the details for you (and more). One example is CPU-Z. A screenshot that shows the information you are looking for:

Screenshot

Now, as per the excellent comment left by Breakthrough (I've copied it in case for any reason he decides to delete his comment):

You can run CPU-Z from a command prompt, and using the -txt=report.txt will place the CPU-Z output into the file report.txt without invoking the GUI (it also mentions a -console switch to output the information to STDOUT, but says it works under Windows XP only for some reason). See additional parameters here for additional details. – Breakthrough

Solution 3

For a better look of the output, consider adding list full after wmic memorychip.

i.e., open cmd then type wmic memorychip list full

enter image description here

Solution 4

wmic MemoryChip is highly outdated and doesn't show correct outputs for DDR3 and up. I've written a PowerShell script that reads the raw SMBIOS tables and parse the Memory Device table (Type 17). Currently it's based on SMBIOS specification version 3.4.0a and will need to be updated in the future if there any new RAM types in the new spec

Sample output:

D:\> .\ram_type.ps1
Size: 8,589,934,592 bytes (8 GB)
Memory form factor: 0x09 DIMM
Memory type: 0x1A (DDR4)
Type detail: 0x80 (Synchronous)
Speed: 2,666 MT/s
=======================
Size: 8,589,934,592 bytes (8 GB)
Memory form factor: 0x09 DIMM
Memory type: 0x1A (DDR4)
Type detail: 0x80 (Synchronous)
Speed: 2,666 MT/s
=======================

Here's the script. Tested on many PCs with DDR3 and DDR4. On many cases you'll see "0 GB" entries because there are still empty slots in the machine

Just save it as *.ps1 and run, or copy the whole script and paste into PowerShell

# Based on System Management BIOS (SMBIOS) Reference Specification 3.4.0a
# https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.4.0a.pdf

# 7.18.1. Form factor @offset 0x0E
[string[]]$FORM_FACTORS = @(
    'Invalid', 'Other', 'Unknown', 'SIMM',                      # 00-03h
    'SIP', 'Chip', 'DIP', 'ZIP'                                 # 04-07h
    'Proprietary Card', 'DIMM', 'TSOP', 'Row of chips',         # 08-0Bh
    'RIMM', 'SODIMM', 'SRIMM', 'FB-DIMM',                       # 0C-0Fh
    'Die'                                                       # 10h
)
# 7.18.2. Memory type @offset 0x12
[string[]]$MEMORY_TYPES = @(
    'Invalid',  'Other',    'Unknown',  'DRAM',                 # 00-03h
    'EDRAM',    'VRAM',     'SRAM',     'RAM',                  # 04-07h
    'ROM',      'FLASH',    'EEPROM',   'FEPROM',               # 08-0Bh
    'EPROM',    'CDRAM',    '3DRAM',    'SDRAM',                # 0C-0Fh
    'SGRAM',    'RDRAM',    'DDR',      'DDR2',                 # 10-13h
    'DDR2 FB-DIMM', 'Reserved', 'Reserved', 'Reserved',         # 14-17h
    'DDR3',     'FBD2',     'DDR4',     'LPDDR',                # 18-1Bh
    'LPDDR2',   'LPDDR3',   'LPDDR4',   'Logical non-volatile device' # 1C-1Fh
    'HBM (High Bandwidth Memory)', 'HBM2 (High Bandwidth Memory Generation 2)',
        'DDR5', 'LPDDR5'                                        # 20-23h
)
# 7.18.3. Type detail @offset 0x13
[string[]]$TYPE_DETAILS = @(
    'Reserved', 'Other', 'Unknown', 'Fast-paged',               # bit 0-3
    'Static column', 'Pseudo-static', 'RAMBUS', 'Synchronous',  # bit 4-7
    'CMOS', 'EDO', 'Window DRAM', 'Cache DRAM',                 # bit 8-11
    'Non-volatile', 'Registered (Buffered)',
        'Unbuffered (Unregistered)', 'LRDIMM'                   # 0C-0Fh
)

function lookUp([string[]]$table, [int]$value)
{
    if ($value -ge 0 -and $value -lt $table.Length) {
        $table[$value]
    } else {
        "Unknown value 0x{0:X}" -f $value
    }
}

function parseTable([array]$table, [int]$begin, [int]$end)
{
    [int]$index = $begin
    $size = [BitConverter]::ToUInt16($table, $index + 0x0C)
    if ($size -eq 0xFFFF) {
        "Unknown memory size"
    } elseif ($size -ne 0x7FFF) {
        if (($size -shr 15) -eq 0) { $size *= 1MB } else { $size *= 1KB }
        # if ([Math]::Floor($size/32768) -eq 0) { $size *= 1MB } else { $size *= 1KB } # For PowerShell < 3.0
    } else {
        $size = [BitConverter]::ToUInt32($table, $index + 0x1C)
    }
    "Size: {0:N0} bytes ({1} GB)" -f $size, ($size/1GB)

    $formFactor = $table[$index + 0x0E]
    $formFactorStr = $(lookUp $FORM_FACTORS $formFactor)
    "Memory form factor: 0x{0:X2} {1}" -f $formFactor, $formFactorStr

    $type = $table[$index + 0x12]
    "Memory type: 0x{0:X2} ({1})" -f $type, $(lookUp $MEMORY_TYPES $type)

    $typeDetail = [BitConverter]::ToUInt16($table, $index + 0x13)
    $details = 0..15 |% {
        if (((1 -shl $_) -band $typeDetail) -ne 0) { "{0}" -f $TYPE_DETAILS[$_] }
        # if (([int]([Math]::Pow(2, $_)) -band $typeDetail) -ne 0) { "{0}" -f $TYPE_DETAILS[$_] } # For PowerShell < 3.0
    }
    "Type detail: 0x{0:X2} ({1})" -f $typeDetail, $($details -join ' | ')

    $speed = [BitConverter]::ToUInt16($table, $index + 0x15)
    if ($speed -eq 0) {
        "Unknown speed"
    } elseif ($speed -ne 0xFFFF) {
        "Speed: {0:N0} MT/s" -f $speed
    } else {
        "Speed: {0:N0} MT/s" -f [BitConverter]::ToUInt32($table, $index + 0x54)
    }
    "======================="
}

$index = 0

$END_OF_TABLES = 127
$MEMORY_DEVICE = 17

$BiosTables = (Get-WmiObject -ComputerName . -Namespace root\wmi -Query `
    "SELECT SMBiosData FROM MSSmBios_RawSMBiosTables" `
).SMBiosData

do
{
    $startIndex = $index

    # ========= Parse table header =========
    $tableType = $BiosTables[$index]
    if ($tableType -eq $END_OF_TABLES) { break }

    $tableLength = $BiosTables[$index + 1]
    # $tableHandle = [BitConverter]::ToUInt16($BiosTables, $index + 2)
    $index += $tableLength

    # ========= Parse unformatted part =========
    # Find the '\0\0' structure termination
    while ([BitConverter]::ToUInt16($BiosTables, $index) -ne 0) { $index++ }
    $index += 2

    # adjustment when the table ends with a string
    if ($BiosTables[$index] -eq 0) { $index++ }

    if ($tableType -eq $MEMORY_DEVICE) { parseTable $BiosTables $startIndex $index }
} until ($tableType -eq $END_OF_TABLES -or $index -ge $BiosTables.length)

Solution 5

Another alternative you can use, which is free, is Speccy... by the same people who make CCleaner.

It gives you all your hardware specs, as well as temps, voltages, and other data in real time

Share:
587,842

Related videos on Youtube

baalji av
Author by

baalji av

Updated on September 18, 2022

Comments

  • baalji av
    baalji av almost 2 years

    How to find the RAM type (DDR2/DDR3) of the system using command prompt?

    I have tried SYSTEMINFO in command prompt but it did not display the RAM type.

    • Dave
      Dave about 11 years
      Do you know the model of your motherboard? If not, see this superuser.com/questions/175213/… then look up the manual to find out!
    • Ravindra Bawane
      Ravindra Bawane over 6 years
      There is very likely a good duplicate on SU, but the one marked is definitely NOT a duplicate.
    • Scott - Слава Україні
      Scott - Слава Україні over 5 years
      Agreed. A couple of the “answers” to that other question are actually answers to this question; i.e., they were posted in the wrong place. In particular, @terdon’s lshw answer to the other question might make a valuable addition to this thread (except for the fact that it’s Linux-centric, and this question is about Windows). But the linked question is not a duplicate of this one.
  • baalji av
    baalji av about 11 years
    Thank u. When I enter this command it displays memory type as 21 which is equal to DDR2, but the actual memory type in my slot is DDR3. It does confusing.pls explain.
  • Karan
    Karan about 11 years
    @baaljiav: What do CPU-Z, Speccy etc. show? Is there any specific reason you want to display the info at the command prompt?
  • Pacerier
    Pacerier about 9 years
    @Karan, Wouldn't CPU-Z show the same as the cmd? Indeed wouldn't the cmd be more reliable than CPU-Z?
  • Pacerier
    Pacerier about 9 years
    Why didi Speccy get 0 votes but CPU-Z get 10 upvotes?
  • Karan
    Karan about 9 years
    @Pacerier: Phew, you're asking me about a comment posted almost 2 years back! From what I see I was responding to the OP saying that wmic's output wasn't matching the actual memory he installed, and thus suggested double-checking with CPU-Z, Speecy and the like.
  • Karan
    Karan about 9 years
    @Pacerier: I see you didn't upvote it either. :) Raising this issue is pointless, especially on 2 year old answers. You've been around long enough to know that sometimes there's no (apparent) rhyme or reason for people's voting. I've seen better answers (not saying this is one) with far less votes or even none compared to worse answers, with the latter even being accepted by the OPs sometimes. That's just how it is. If you want to debate this the best place is Meta, or Chat.
  • Pacerier
    Pacerier about 9 years
    @Karan, How does CPU-Z do it then, if cmd is not able to do it?
  • Karan
    Karan about 9 years
    @Pacerier: Why, are you claiming CPU-Z and wmic (not cmd) employ the exact same code? If you want to know how CPU-Z works you can get hold of its source code if available and check. Also, I'm not the one claiming that wmic cannot do something. The OP said wmic's output doesn't match reality, so perhaps you should ask him whether he found CPU-Z's output more in line with his expectations or not. Good luck with that though given how old this question is. I am not going to debate any more about simple suggestions I made in a comment 2 years ago.
  • Jayendran
    Jayendran over 6 years
    If you see a 0 there, there are chances that it’s a DDR4 RAM, unknown to WMIC command.
  • Scott - Слава Україні
    Scott - Слава Україні over 5 years
    An answer by “myrobostation BG” suggests adding the DeviceLocator property.
  • Scott - Слава Україні
    Scott - Слава Україні over 5 years
    Note that CPU-Z must be run as administrator (i.e., with elevated permissions)  to be able to get information on memory.
  • Scott - Слава Україні
    Scott - Слава Україні over 5 years
    Note that Speccy must be run as administrator (i.e., with elevated permissions) to be able to get information on memory.
  • Ivan Castellanos
    Ivan Castellanos almost 5 years
    Useless, only says "4 Gbytes" and nothing else
  • phuclv
    phuclv about 4 years
    @Pacerier cmd doesn't do anything. It's wmic that does the job. But the implementation in wmic is old and hasn't been updated to the latest SMBIOS specs so it doesn't recognize anything beyond DDR2. See my answer for an updated solution. CPU-Z and Speccy are doing the same way to detect memory configuration
  • phuclv
    phuclv about 4 years
    Look at the MemoryType=0 line, wmic can't detect DD4 or other new types of memory because it hasn't been updated to the latest SMBIOS spec so don't use it. See my answer for a solution that actually works
  • phuclv
    phuclv about 4 years
    how is this different from the current top voted answer? And the OP is asking about memory type (DDR2, DDR3, etc.) not about the bank, but wmic command doesn't work for DDR3, DDR4 and up
  • phuclv
    phuclv about 4 years
    is the downvote just because some guys are afraid of powershell?
  • Kevin Groenke
    Kevin Groenke almost 4 years
    This is the only reliable answer that doesnt require third party software and is backed by the specification. Why is this the second lowest answer?
  • phuclv
    phuclv almost 4 years
    this doesn't actually answer the question which is about getting the RAM type in command prompt
  • Oliver Meyer
    Oliver Meyer over 3 years
    Does work as advertised. Needs additional info on how to execute. I stored in c:\tmp\getMemoryInfo.ps1 In Powershell I did the following: Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process and then c:\tmp\getMemoryInfo.ps1 The first command was required to allow the execution of an unsigned script.
  • Oliver Meyer
    Oliver Meyer over 3 years
    Does not work with DDR4
  • phuclv
    phuclv over 3 years
    @OliverMeyer you don't need to set the execution policy if you copy and paste directly into PowerShell
  • Janus Bahs Jacquet
    Janus Bahs Jacquet over 3 years
    When I try to run this script in PowerShell, I get “You must provide a value expression on the right-hand side of the '-' operator.” on line 50, char 21 (the first dash in if (($size -shr 15) -eq 0)). This is on a very old machine running Windows 7, so probably an ancient version of PowerShell too – could that be why?
  • phuclv
    phuclv over 3 years
    @JanusBahsJacquet yes, shift operators have only been added since PowerShell 3.0 while Windows 7 was shipped with PS 2.0. So just replace that right shift by [math]::floor($size/32767). Do the same for the remaining shifts. Can you check the updated code to see if it's working?
  • phuclv
    phuclv over 3 years
    @JanusBahsJacquet yes that's a shift-left. You don't need to use floor in this case. And the number should be 32768 for both cases, my bad. I've updated the code in the answer, just copy them out and toggle the comment on the 2 lines with shift
  • phuclv
    phuclv over 3 years
    @JanusBahsJacquet fixed the bracket and tested on my PC
  • Janus Bahs Jacquet
    Janus Bahs Jacquet over 3 years
    Yes, works like a charm now!