How to find the RAM type in command prompt?

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