• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4081
  • Last Modified:

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

please help
0
itbabe
Asked:
itbabe
  • 2
  • 2
  • 2
  • +1
1 Solution
 
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
 
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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
 
itbabeAuthor Commented:
If you replace "Where Name" by "Where Executablepath" it works according to my requirements.
0
 
merowingerCommented:
nice idea :)
0
 
modus_operandiCommented:
Closed, 500 points refunded.
modus_operandi
EE Moderator
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now