Home > Web Front-end > JS Tutorial > body text

How to get CPU usage in VBScript

高洛峰
Release: 2017-01-16 10:35:28
Original
1805 people have browsed it

VBScript通过WMI获取CPU使用率的代码

度娘中,搜索关键词“WMI CPU使用率”,得到的全是《python使用WMI监视系统-CPU使用率》,不用看,肯定又是采集的。

Python固然强大,但是调用WMI还是用VBS比较“正宗”。

On Error Resume Next
strComputer = "."
  
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor",,48)
  
For Each objItem in colItems
WScript.Echo "LoadPercentage: " & objItem.LoadPercentage
Next
Copy after login

以上所述就是本文的全部内容了,希望大家能够喜欢。

更多VBScript获取CPU使用率的方法相关文章请关注PHP中文网!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!