Skip to content

Instantly share code, notes, and snippets.

@ginpei
Last active June 5, 2024 23:48
Show Gist options
  • Save ginpei/f6bdf53d54d892933ff976ab32155808 to your computer and use it in GitHub Desktop.
Save ginpei/f6bdf53d54d892933ff976ab32155808 to your computer and use it in GitHub Desktop.
Get CPU temperature for Windows by Node.js
console.log(Math.round((require('child_process').execSync('wmic /namespace:\\\\root\\wmi PATH MSAcpi_ThermalZoneTemperature get CurrentTemperature').toString().split('\r\n')[1].trim()) / 10 - 273)+ '℃')
> node -e "console.log(Math.round((require('child_process').execSync('wmic /namespace:\\\\root\\wmi PATH MSAcpi_ThermalZoneTemperature get CurrentTemperature').toString().split('\r\n')[1].trim()) / 10 - 273)+ '℃')"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment