@echo off REM ############################################# REM Description: This script is used to get cpu information. REM NOTE: https://www.cygwin.com/ REM Required files: sed, uniq, cut, sort, wc REM ############################################# REM ######################### REM Set variables REM ######################### set PATH=%PATH%;C:\"Program Files"\"System Utilities"\bin\ REM ######################### REM Main REM ######################### for /f "tokens=*" %%x in ('wmic cpu get Name /value ^| find "Name=" ^| sed "s/\s*$//g" ^| uniq ^| cut -d "=" -f 2-') do (set cpu_model=%%x) for /f "tokens=*" %%x in ('wmic cpu get DeviceID /value ^| find "DeviceID=" ^| sed "s/\s*$//g" ^| sort ^| uniq ^| wc -l') do (set physical_cpus=%%x) goto :find_cores_per_cpu :find_cores_per_cpu set failures=0 wmic cpu get /value | find "NumberOfCores=" > nul 2>&1 if %errorlevel% equ 0 goto :find_cores_per_cpu_available set cores_per_cpu=NA if %cores_per_cpu% equ NA set /a failures=%failures% + 1 goto :find_threads_per_cpu :find_cores_per_cpu_available for /f "tokens=*" %%x in ('wmic cpu get NumberOfCores /value ^| find "NumberOfCores=" ^| sed "s/\s*$//g" ^| uniq ^| cut -d "=" -f 2-') do (set cores_per_cpu=%%x) goto :find_threads_per_cpu :find_threads_per_cpu wmic cpu get /value | find "NumberOfLogicalProcessors=" > nul 2>&1 if %errorlevel% equ 0 goto :find_threads_per_cpu_available set threads_per_cpu=NA if %threads_per_cpu% equ NA set /a failures=%failures% + 1 set hyper_threading=NA set logical_cpus=NA goto :cpu_summary :find_threads_per_cpu_available for /f "tokens=*" %%x in ('wmic cpu get NumberOfLogicalProcessors /value ^| find "NumberOfLogicalProcessors=" ^| sed "s/\s*$//g" ^| uniq ^| cut -d "=" -f 2-') do (set threads_per_cpu=%%x) goto :find_hyper_threading :find_hyper_threading if %threads_per_cpu% gtr %cores_per_cpu% goto :find_hyper_threading_available set hyper_threading=No goto :find_logical_cpus :find_hyper_threading_available set hyper_threading=Yes goto :find_logical_cpus :find_logical_cpus set /a logical_cpus=%physical_cpus% * %threads_per_cpu% goto :cpu_summary :cpu_summary if %failures% gtr 0 goto :wmi_patch_needed echo Model: %cpu_model% echo Hyper-Threading: %hyper_threading% echo Physical CPU's: %physical_cpus% echo Cores per CPU: %cores_per_cpu% echo Threads per CPU: %threads_per_cpu% echo Logical CPU's: %logical_cpus% goto :exit :wmi_patch_needed echo NOTE: Hotfix needed for WMI for CPU information, Windows XP - http://support.microsoft.com/kb/936235/, Windows 2003 - http://support.microsoft.com/kb/932370/ goto :exit REM ######################### REM This is where the script ends. REM ######################### :exit