Solved

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
8
4,011 Views
Last Modified: 2008-06-10
please help
0
Comment
Question by:itbabe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
8 Comments
 
LVL 23

Expert Comment

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

Author Comment

by:itbabe
ID: 20356563
I have 2 java.exe's running and only want to kill the one at a particular path.
0
 
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.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 31

Expert Comment

by:merowinger
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
   objProcess.Terminate()
Next
0
 

Accepted Solution

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

Expert Comment

by:merowinger
ID: 20448714
nice idea :)
0
 
LVL 1

Expert Comment

by:modus_operandi
ID: 20479114
Closed, 500 points refunded.
modus_operandi
EE Moderator
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Script to copy or move mouse-selected collection of files plus targets referenced by shortcuts (.lnk) The purpose of this article is to help illuminate the real challenges and options available (where they may exist) for utilizing simple scriptin…
This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

726 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