Skip to content

Instantly share code, notes, and snippets.

@kapb14
Created October 23, 2015 14:41
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kapb14/24ac614fe6b75e5e3195 to your computer and use it in GitHub Desktop.
Save kapb14/24ac614fe6b75e5e3195 to your computer and use it in GitHub Desktop.
get Cpu temperature (in Celsius) using 'wmic' from .bat
@echo off
:: for /f "delims== tokens=2" %%a in (
:: 'wmic /namespace:\\root\wmi PATH MSAcpi_ThermalZoneTemperature get CurrentTemperature /value'
:: ) do (
:: set /a degrees_celsius=%%a / 10 - 273
:: )
::
:: echo %degrees_celsius%
for /f "skip=1 tokens=2 delims==" %%A in ('wmic /namespace:\\root\wmi PATH MSAcpi_ThermalZoneTemperature get CurrentTemperature /value') do set /a "HunDegCel=(%%~A*10)-27315"
echo %HunDegCel:~0,-2%.%HunDegCel:~-2% Degrees Celsius
REM http://stackoverflow.com/questions/24004300/batch-file-get-cpu-temperature-in-c-and-set-as-variable
@kanagasabapathi
Copy link

C:\WINDOWS\system32>wmic /namespace:\root\wmi PATH MSAcpi_ThermalZoneTemperature get CurrentTemperature
Node - ADMIN
ERROR:
Description = Not supported

@fromage9747
Copy link

@kanagasabapathi your hardware doesn't support the call. Mine however seems to always return 29.85 degree's celcius. Using coretemp, my tempreatues are well into the 40's. so not so sure on this one. Tried of a few pc's with the same result.

@Rohit-069
Copy link

wmic /namespace:\root\wmi PATH MSAcpi_ThermalZoneTemperature get CurrentTemperature
IT gives Me that below result.
CurrentTemperature
3322 (what its mean)
3032

@Artem7-ops
Copy link

It just writing .5 Degrees Celsius

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment