I like how Crash does it with a .bat file as it is quick, short and a simple approach. This can be done with a VBScript but requires more code to get things done:
Code:
Option Explicit
Dim objWMIService, objProcess, colProcess
Dim xComputer, xProcessKill ,xProcessKill2,xProcessKill3,xProcesskill4
xComputer = "."
xProcessKill = "'Excel.exe'"
xProcessKill2 = "'notepad.exe'"
xProcessKill3 = "'psp.exe'"
xProcessKill4 = "'firefox.exe'"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& xComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = " & xProcessKill)
For Each objProcess in colProcess
objProcess.Terminate()
Next
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = " & xProcessKill2)
For Each objProcess in colProcess
objProcess.Terminate()
Next
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = " & xProcessKill3)
For Each objProcess in colProcess
objProcess.Terminate()
Next
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = " & xProcessKill4)
For Each objProcess in colProcess
objProcess.Terminate()
Next
The above code in .vbs would kill:
Code:
xProcessKill = "'Excel.exe'"
xProcessKill2 = "'notepad.exe'"
xProcessKill3 = "'psp.exe'"
xProcessKill4 = "'firefox.exe'"
Excel, notepad, paint shop pro and firefox if they are running.
Yes, you would copy and paste Crash's code into notepad and taylor it for your processes to kill and save it as a .bat file (likely to your desktop). That should work just fine.
Ron