Detect CPU: Pentium, Atom, Core Duo, Core 2 Duo, i5, i7

I was at BestBuy today and they are still selling windows laptops that feature Intel Atom and Pentium processors.

My app has some features which just can’t work on the old, slow cohort, and I’m curious if there’s an easy way to detect the CPU?

For example, if the # of CPU cores is >= 4 then it’s an i5 or higher.

Well on OS X sysctl is the answer

the cpu name

sysctl -n machdep.cpu.brand_string

of cores

sysctl -n hw.ncpu

Windows - WMI (which you can access from the cmd line)

 wmic CPU get NAME

#of cores

wmic cpu get NumberOfCores, NumberOfLogicalProcessors

or even more simply

C:\\Windows>echo %NUMBER_OF_PROCESSORS%

http://www.nextofwindows.com/how-to-find-out-bios-motherboard-and-cpu-info-from-command-line

If checking the laptop before buying when the sticker is missing, open Windows Explorer and right-click on “Computer”, select Properties. Or go to Control Panel - System.

If checking from within your app for hardware requirement, you can check the Registry:

HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor

If you subscribe to xDev then you might want to read the Multicore primer series. Windows is covered in issue 14.3 and 14.4.

But in short (as Norman said) WMIC is the way to go.

WMIC is available for WinXP Pro SP3/Win2003 and upwards (though there was a hotfix to make it run on WinXP Pro SP2 - see https://support.microsoft. com/en-us/kb/936235)

Just be aware that due to system policies not all cores might be available to a user (on multi-user systems the number of cores you are allowed to use is set by the admin).

Off topic: useful site for Win10 users.

CPUID class:
http://www.monkeybreadsoftware.net/class-cpuidmbs.shtml
gives you family, model, vendor and more.