Google关键词“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
复制代码
参考链接:http://msdn.microsoft.com/en-us/library/aa394373%28v=vs.85%29.aspx
原文:http://demon.tw/programming/vbs-wmi-cpu-usage.html |