Author Topic: Monitor CPU temperature in Windows  (Read 3166 times)

0 Members and 1 Guest are viewing this topic.

Offline Richard Frost

  • Seasoned Forum Regular
  • Posts: 316
  • Needle nardle noo. - Peter Sellers
    • View Profile
Monitor CPU temperature in Windows
« on: December 18, 2021, 02:40:19 am »
1) delete the first line if you don't download the icon file
2) needs liberati.ttf, a font that used to be included with QB64
3) works as is with XP, requires running as administrator in 10

Code: QB64: [Select]
  1. $ExeIcon:'temp2.ico'
  2. q$ = Chr$(34) '                             quote character
  3. Screen _NewImage(140, 64, 32)
  4. If _FileExists("liberati.ttf") = 0 Then System
  5. f& = _LoadFont("liberati.ttf", 60)
  6.  
  7. Open "ztemp.bat" For Output As #1
  8. Print #1, "@echo off"
  9. Print #1, "for /f " + q$ + "skip=1 tokens=2 delims==" + q$ + " %%A in ('wmic /namespace:\\root\wmi PATH MSAcpi_ThermalZoneTemperature get CurrentTemperature /value') do set /a " + q$ + "HunDegCel=(%%~A*10)-27315" + q$
  10. Print #1, "echo %HunDegCel:~0,-2%.%HunDegCel:~-2% Degrees Celsius"
  11.  
  12.     Shell _Hide "ztemp.bat > ztemp.dat"
  13.     If _FileExists("ztemp.dat") Then
  14.         Cls
  15.         Open "ztemp.dat" For Input As #1
  16.         Line Input #1, z$
  17.         Close #1
  18.         z& = Val(z$)
  19.         _Font f&: _PrintString (10 - (z < 100) * 20, 5), LTrim$(Str$(z&))
  20.         _Font 14: Locate 2, 15: Print Chr$(248); "C";
  21.     End If
  22. Shell "del ztemp*.*"

* temp2.ico (Filesize: 167.42 KB, Dimensions: 16x16, Views: 387)
It works better if you plug it in.

Offline DANILIN

  • Forum Regular
  • Posts: 128
    • View Profile
    • Danilin youtube
Re: Monitor CPU temperature in Windows
« Reply #1 on: December 18, 2021, 01:19:52 pm »
cpu_temp.bat
Code: [Select]
@ wmic /namespace:\\root\wmi PATH MSAcpi_ThermalZoneTemperature get CurrentTemperature
@ pause
CurrentTemperature
3262
3030
Kelvin
Russia looks world from future. big data is peace data.
https://youtube.com/playlist?list=PLBBTP9oVY7IagpH0g9FNUQ8JqmHwxDDDB
i never recommend anything to anyone and always write only about myself