Kill Open Applications Script
I tend to put my laptop to “sleep” at the end of the office day but often fire it back up at home. One bad habit of mine is having too many apps running at the same time (thanks to UltraMon the problem is now worse). Putting a PC into “sleep” tries to commit things to RAM and if it runs out (it does) then to hard disk. “Awakening” causes it to push things off of the hard disk and back into memory. This takes a long time. My solution was a simple VBS script to transverse and kill the most common applications right before “sleep”. I’ve tied this to a slickrun command “kill” to make it easier to run. Script below, enjoy!
strComputer = "." dim oKillThese For Each x in oKillThese Set objWMIService = GetObject("winmgmts:" _ Next
oKillThese = Array("firefox.exe", "iexplorer.exe", "safari.exe", "TweetDeck.exe", "OUTLOOK.EXE", "chrome.exe", "notepad++.exe", "iTunes.exe", "javaw.exe", "cmd.exe", "Moe.exe", "Surround SCM Client.exe", "devenv.exe", "SqlWb.exe", "Navicat.exe")
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process WHERE Name = ‘" & x & "’")
For Each objProcess in colProcessList
objProcess.Terminate()
Next
Written by Tim on October 7th, 2008 with 2 comments.
Read more articles on windows.