I am trying to retrieve the Number of CPUs and Cores per CPU using Command Prompt. I have executed the following command:
wmic cpu get NumberOfCores, NumberOfLogicalProcessors/Format:List
I get this error: wmic' is not recognized as an internal or external command, operable program or batch file
I am executing this on a Windows Server 2008 R2 machine. I believe the 'wmic' command is compatible on this windows.
The directory I am running the command promt from is 'C:\Windows>
Any advice please?
Based upon your comments - your path
statement has been changed/is incorrect or the path
variable is being incorrectly used for another purpose.
You can use the environment variable NUMBER_OF_PROCESSORS
for the total number of cores:
echo %NUMBER_OF_PROCESSORS%
You can also enter msinfo32
into the command line.
It will bring up all your system information. Then, in the find box, just enter processor
and it will show you your cores and logical processors for each CPU. I found this way to be easiest.
If you want to find how many processors (or CPUs) a machine has the same way %NUMBER_OF_PROCESSORS%
shows you the number of cores, save the following script in a batch file, for example, GetNumberOfCores.cmd
:
@echo off
for /f "tokens=*" %%f in ('wmic cpu get NumberOfCores /value ^| find "="') do set %%f
And then execute like this:
GetNumberOfCores.cmd
echo %NumberOfCores%
The script will set a environment variable named %NumberOfCores%
and it will contain the number of processors.
In order to check the absence of physical sockets run:
wmic cpu get SocketDesignation
来源:https://stackoverflow.com/questions/22919076/find-number-of-cpus-and-cores-per-cpu-using-command-prompt