首页 > 其他 > 详细

查看CPU使用率

时间:2018-09-06 22:08:38      阅读:154      评论:0      收藏:0      [点我收藏+]
rem 如果wmi服务(服务名为Winmgmt)坏掉了,需要到system32\webm目录下执行如下注释的命令

rem for %i in (*.dll) do RegSvr32 -s %i
rem Regsvr32 -s scrcons.exe
rem Regsvr32 -s unsecapp.exe
rem Regsvr32 -s wbemtest.exe
rem Regsvr32 -s WinMgmt.exe
rem Regsvr32 -s WmiApSrv.exe
rem Regsvr32 -s WmiPrvSE.exe

@echo off
@echo On Error Resume Next>temp.vbs
@echo.>>temp.vbs
@echo dim iCpuUsePercentage>>temp.vbs
@echo dim objFileStream>>temp.vbs
@echo dim objTextFileWriter>>temp.vbs
@echo Set objProc = GetObject("winmgmts:\\.\root\cimv2:win32_processor=‘cpu0‘")>>temp.vbs
@echo iCpuUsePercentage=objProc.LoadPercentage>>temp.vbs
@echo set objFileStream =CreateObject("Scripting.Filesystemobject")>>temp.vbs
@echo set objTextFileWriter=objFileStream.opentextfile("log.tmp",8,True)>>temp.vbs
@echo objTextFileWriter.WriteLine(iCpuUsePercentage)>>temp.vbs
@echo objTextFileWriter.close>>temp.vbs
start temp.vbs
ping -n 3 127.0.0.1 >nul
del %~dp0temp.vbs
@echo CPU占用率:
type log.tmp
pause
del %~dp0log.tmp

 

参考

查看CPU使用率

原文:https://www.cnblogs.com/mobilecard/p/9601151.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!