Win10 CMD 命令行查看CPU温度

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

 

posted @ 2022-05-11 00:10  lsgxeva  阅读(16209)  评论(0编辑  收藏  举报