JSI Tip 8751. How can a script return the CPU Brand String on Windows XP and Windows Server 2003?

The CPU Brand String is contained in the FriendlyName Value Name under a registry key similar to:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ACPI\GenuineIntel_-_x86_Family_15_Model_\_0 Where _0 is the first CPU, _1 is the second CPU, etc..


On one of my laptops, FriendlyName at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ACPI\GenuineIntel_-_x86_Family_6_Model_9\_0 contains Intel(R) Pentium(R) M processor 1700MHz.

On one of my desktops, FriendlyName contains Intel(R) Xeon(TM) CPU 2.66GHz at:

I have scripted BrandString.bat to return all the FriendlyName data values.

The syntax for using BrandString.bat is:

BrandString VarName

Where VarName is a call directed environment variable that will be set as follows:

If CPU 0 cannot be found, VarName is set to NONE.
If CPU 0 is found, VarName is set to the number of CPUs and VarName0 is set to the CPU 0 FriendlyName.
If additional CPUs are found, VarName1, etc., is set to the appropriate FriendlyName.

BrandString.bat contains:
@echo off
if \{%1\}==\{\} @echo Syntax: BrandString CPU&goto :EOF
set $BrandStringVar=%1
set %1=
set $BrandStringkey=N
for /f "Tokens=*" %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Enum\ACPI" /S^|FIND "HKEY_LOCAL_MACHINE"^|Findstr /E /L /C:"\_0"') do (
 set $BrandStringkey="%%a"
If "%$BrandStringkey%" EQU "N" goto err
set $BrandStringkey=%$BrandStringkey:\_0"="%
set /a $BrandStringCPU=0
for /f "Tokens=1,2*" %%a in ('reg query %$BrandStringkey% /S^|FIND "FriendlyName"^|FIND "REG_SZ"') do (
 set $BrandStringString=%%c
 call :parse
call set %$BrandStringVar%=%$BrandStringCPU%
set $BrandStringCPU=
set $BrandStringkey=
set $BrandStringString=
set $BrandStringVar=
goto :EOF
@echo Brandstring - CPUID NOT found.
set $BrandStringkey=
set $BrandStringVar=
set %1=NONE
goto :EOF
call set %$BrandStringVar%%$BrandStringCPU%=%$BrandStringString%
set /a $BrandStringCPU=%$BrandStringCPU% + 1

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.