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

Posted on 2007-11-27
Last Modified: 2008-06-10
please help
Question by:itbabe
  • 2
  • 2
  • 2
  • +1
LVL 23

Expert Comment

by:Ashish Patel
ID: 20356555
if you are using win xp then use shell function and fire "tskill java.exe"

Author Comment

ID: 20356563
I have 2 java.exe's running and only want to kill the one at a particular path.
LVL 23

Expert Comment

by:Ashish Patel
ID: 20356584
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.
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

LVL 31

Expert Comment

ID: 20356674
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

Accepted Solution

itbabe earned 0 total points
ID: 20444042
If you replace "Where Name" by "Where Executablepath" it works according to my requirements.
LVL 31

Expert Comment

ID: 20448714
nice idea :)

Expert Comment

ID: 20479114
Closed, 500 points refunded.
EE Moderator

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently I finished a vbscript that I thought I'd share.  It uses a text file with a list of server names to loop through and get various status reports, then writes them all into an Excel file.  Originally it was put together for our Altiris server…
This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question