Find Number of CPUs and Cores per CPU using Command Prompt

后端 未结 5 454
一向
一向 2021-01-31 15:24

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, NumberOfLogic

5条回答
  •  抹茶落季
    2021-01-31 16:17

    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.

提交回复
热议问题