欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

通过 Win10 CMD 命令行查看 CPU 温度

最编程 2024-04-12 13:54:56
...

Win10 CMD 命令行查看CPU温度

来源 https://www.bilibili.com/read/cv10952578/

 

〇、打开 Cmd 或者 PowerShell
鼠标移动至左下角,右键单击,然后点击 Windows PowerShell

通过 Win 徽标打开Power Shell

 

一、输入以下代码并运行


1.0 方法一

"CPU: $(((Get-CimInstance -Namespace root/WMI -ClassName MSAcpi_ThermalZoneTemperature)[0].CurrentTemperature - 2731.5) / 10) C"

 

1.1 方法二

function Get-Temperature {
    $t = Get-WmiObject MSAcpi_ThermalZoneTemperature -Namespace "root/wmi"
    $returntemp = @()
    foreach ($temp in $t.CurrentTemperature)
    {
    $currentTempKelvin = $temp/10
    $currentTempCelsius = $currentTempKelvin - 273.15

    $currentTempFahrenheit = (9/5) * $currentTempCelsius + 32

    $returntemp += $currentTempCelsius.ToString() + " C : " + $currentTempFahrenheit.ToString() + " F : " + $currentTempKelvin + "K"
    }
    return $returntemp
}

Get-Temperature

 

二、结果的输出

CPU温度查询代码输出结果

 

三、API Reference

https://wutils.com/wmi/root/wmi/msacpi_thermalzonetemperature/

https://docs.microsoft.com/en-us/documentation/

 

=========== End