Created
October 23, 2015 14:41
-
-
Save kapb14/24ac614fe6b75e5e3195 to your computer and use it in GitHub Desktop.
get Cpu temperature (in Celsius) using 'wmic' from .bat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It just writing .5 Degrees Celsius