Hi all,
I need to get the number of physical CPUs (or sockets) under Windows.
It seems like SystemInformationMBS as well as GetSystemInfo in Kernel32 give infos only on logical processors on Windows.
So I’m wondering if there is a way to do that…
Thanks in advance for any suggestion.
Jean-Luc
Shell the command:
echo %NUMBER_OF_PROCESSORS%
And read the output. You could also use:
wmic computersystem get numberofprocessors
but reading the environment variable via echo will be faster.
Edit: I just realized this also returns the number of cores, not the number of physical CPUs.
Actually, returns the number of logical cores, not phisical ones.
Run the following command in a shell
wmic computersystem get numberofprocessors
Thanks so much to Christian Wheel, Ivan Tellez and Matthew Stevens.
wmic computersystem get numberofprocessors
is the solution, while
echo %NUMBER_OF_PROCESSORS%
returns the number of logical cores (that is Threads).
Jean-Luc
1 Like