标题: [问题求助] 请告诉把获取CPU温度的vb代码转成vbs代码 [打印本页]
作者: winload 时间: 2015-12-10 12:21 标题: 请告诉把获取CPU温度的vb代码转成vbs代码
- Private Sub Command1_Click()
-
- MsgBox "CPU 温度 : " & CPU_Temperature & " C"
-
- End Sub
-
- Private Function CPU_Temperature() As Integer
-
- Dim WMIsvc As Object
-
- Dim CltItems As Object, CltItem As Object
-
- Dim Q As String
-
- Set WMIsvc = GetObject("winmgmts:\\.\root\WMI")
-
- Q = "SELECT * FROM MSAcpi_ThermalZoneTemperature"
-
- Set CltItems = WMIsvc.ExecQuery(Q, , 48)
-
- For Each CltItem In CltItems
-
- CPU_Temperature = CltItem.CurrentTemperature
-
- Next
-
- CPU_Temperature = (CPU_Temperature - 2732) / 10
-
- Set CltItem = Nothing
-
- Set CltItems = Nothing
-
- Set WMIsvc = Nothing
-
- End Function
复制代码
作者: pcl_test 时间: 2015-12-10 14:15
- MsgBox "CPU 温度 : " & CPU_Temperature & "℃"
-
- Function CPU_Temperature()
- Set WMIsvc = GetObject("winmgmts:\\.\root\wmi")
- Set CltItems = WMIsvc.ExecQuery("Select * from MSAcpi_ThermalZoneTemperature",,48)
-
- For Each CltItem in CltItems
- CPU_Temperature = CltItem.CurrentTemperature
- Next
- CPU_Temperature = (CPU_Temperature - 2732) / 10
- End Function
复制代码
作者: winload 时间: 2015-12-10 14:27
万分感谢!
作者: winload 时间: 2015-12-10 15:29
回复 2# pcl_test
请问可以用批处理实现吗 可能吗? 在不调用vbs的情况下
欢迎光临 批处理之家 (http://bathome.net./) |
Powered by Discuz! 7.2 |