我们知道 Windows 电脑没有监控 CPU 温度的功能,如果想知道 CPU 温度需要安装软件,比如鲁大师。
那么是否可以不安装软件,就实现 CPU 的温度监控呢?
以管理员权限执行如下 PowerShell 脚本:
方法一:
1 |
"CPU: $(((Get-CimInstance -Namespace root/WMI -ClassName MSAcpi_ThermalZoneTemperature)[0].CurrentTemperature - 2731.5) / 10) C" |
方法二:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
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 |