[help] Script/program To Kill A Process

Is there any script or program out for anything (not just samurize) that when you click it, it will kill a specified process?

#99578

i think you can write batch files to do this.

#99583

if you can learn how to write them, they're simple tho, a command script can

#99597

Ok I figured out the console command to kill a process by name.

Is there any way I can just make a script out of that or an exe?

#99621

A little variation on Judge's KillClient function included in the original DesktopWeatherXML. Change the variable 'strProcess' to whatever you want terminated.

Dim strProcess

strProcess = "Client.exe"   'Change this to whatever executable you want

KillClient(strProcess)

Function KillClient(vProcess)
 Dim objWMIService, colProcessList, objProcess, PID
   Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
   Set colProcessList = objWMIService.ExecQuery("select * from Win32_Process where CommandLine LIKE '%" & vProcess & "%'")
   For Each objProcess in colProcessList
     PID = objProcess.ProcessID
     killPID(PID)
   Next
End Function

Function killPID(PID)
 Dim WshShell
 Set WshShell = CreateObject("wscript.shell")
 WshShell.run "taskkill /PID " & PID, 0
End Function

BTW, for those that aren't running XP Pro you'll need the taskkill.exe file in your system32 folder ;)

taskkill.zip

Attachment: taskkill.zip

#99803

man you are the VBS master! Thanks a bunch once again!

EDIT

It doesnt seem to work too well, it kills samurize as well as lots of other processes. I really need a thing so I can click where the script is on the config and it will execute the console command:

killtask/IM itunes.exe. Just a little exe or something...

#99905

@juno

just change the second line of this vbs from:

strProcess = "Client.exe"

To:

strProcess = "itunes.exe"

and instead of closing samurize it will close itunes.

#100063

Im an idiot, I changed all the str things manually..oh well sometimes things are too easy.

#100255