StardogChampion
Tank
- Joined
- Jul 19, 2003
- Messages
- 8,037
- Reaction score
- 2
I need a window with a single button that runs this code when clicked. If you could allow the customising of the strProcessToKill variable that would be cool, but not required.
I'm downloading VB Express to see if I can do it, but I figured one of you lot might be able to do it quicker.
I'm downloading VB Express to see if I can do it, but I figured one of you lot might be able to do it quicker.
Code:
strComputer = "."
strProcessToKill = "game.exe"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = '" & strProcessToKill & "'")
count = 0
For Each objProcess in colProcess
objProcess.Terminate()
count = count + 1
Next
wscript.echo "Killed " & count & " instances of " & _
strProcessToKill