itbabe
asked on
Vbscript : I need to kill a process at a certain path using vbs. (Java.exe that is located in a certain folder)
please help
if you are using win xp then use shell function and fire "tskill java.exe"
ASKER
I have 2 java.exe's running and only want to kill the one at a particular path.
you cant kill at particular path, but you can either kill all process by name or either by process id (PID) using same tskill command. For more help on that go to command prompt and type tskill and enter key for help.
as asvforce said, u cant kill a process on a specified path, but the following code shows how to kill a task:
Dim objWMIService, objProcess, colProcess
Dim strComputer, strProcessKill
strComputer = "."
strProcessKill = "'calc.exe'"
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=imper sonate}!\\ " & strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery ("Select * from Win32_Process Where Name = " & strProcessKill )
For Each objProcess in colProcess
objProcess.Terminate()
Next
Dim objWMIService, objProcess, colProcess
Dim strComputer, strProcessKill
strComputer = "."
strProcessKill = "'calc.exe'"
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=imper
Set colProcess = objWMIService.ExecQuery ("Select * from Win32_Process Where Name = " & strProcessKill )
For Each objProcess in colProcess
objProcess.Terminate()
Next
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
nice idea :)
Closed, 500 points refunded.
modus_operandi
EE Moderator
modus_operandi
EE Moderator