Vbscript : I need to kill a process at a certain path using vbs. (Java.exe that is located in a certain folder)

please help
itbabeAsked:
Who is Participating?
 
itbabeAuthor Commented:
If you replace "Where Name" by "Where Executablepath" it works according to my requirements.
0
 
Ashish PatelCommented:
if you are using win xp then use shell function and fire "tskill java.exe"
0
 
itbabeAuthor Commented:
I have 2 java.exe's running and only want to kill the one at a particular path.
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
Ashish PatelCommented:
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.
0
 
merowingerCommented:
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=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery ("Select * from Win32_Process Where Name = " & strProcessKill )
For Each objProcess in colProcess
   objProcess.Terminate()
Next
0
 
merowingerCommented:
nice idea :)
0
 
modus_operandiCommented:
Closed, 500 points refunded.
modus_operandi
EE Moderator
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.