批处理文件以°C为单位获取CPU温度并设置为变量 [英] Batch-file get CPU temperature in °C and set as variable

查看:390
本文介绍了批处理文件以°C为单位获取CPU温度并设置为变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取批处理文件来计算Cpu的温度并将其作为变量返回.我知道可以做到,就像我看到的那样.该解决方案可以使用任何外部工具.我在Google上浏览了至少2个小时,但一无所获.谁能帮忙.谢谢.

How do i get a batch-file to work out the temperature of the Cpu and return it as a variable. I know it can be done as i have seen it been done. The solution can use any external tool. I have looked on Google for at least 2 hours but found nothing. Can any one help. Thanks.

推荐答案

下面是一个保留十进制值并使用完整转换值的示例.

Here is an example which keeps the decimal values and uses the full conversion value.

代码

@echo off
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

输出

38.05 Degrees Celsius

这篇关于批处理文件以°C为单位获取CPU温度并设置为变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆