Chrome is the best browser IMHO. However, it does spawn multiple processes. When the slowness kicks in I can see the disk queue via the Performance Monitor (accessed via Task Manager) shoot up to 50 or so. When this happens killing processes via Task Manager is slow. I think Task Manager sends a message to the process's message queue saying "please quit". But I need to take back control of my computer far quicker.
It seems that WMI and the Win32_Process objects we can terminate immediately all the chrome.exes. Here is some code. Caution, use with care.
Option Explicit
'**********************************************************************************
'* Terminate, immediately
'**********************************************************************************
Function QuitChrome()
Dim objWMIService As Object
Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")
Dim colItems As Object
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Process" & _
" WHERE Name = 'chrome.exe'", , 48)
Dim objItem As Object
For Each objItem In colItems
objItem.Terminate
Next
End Function
Some feedback for some readers have pointed out a nice command line equivalent to kill Chrome.exe
taskkill /f /im chrome.exe
Thanks for that. This is an Excel coding blog but thanks anyway.
No comments:
Post a Comment