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
3,943 Views
Last Modified: 2008-06-10
please help
0
Comment
Question by:itbabe
  • 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help on VBSCript Font and color 1 68
VBA code shorten run time 4 54
Scraping specific data within an XML document 19 54
Problem to open text file 11 70
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

910 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now