Solved

Vbscript question : How can an executable be killed,  using vbscript.

Posted on 2006-06-21
3
208 Views
Last Modified: 2010-04-17
please help.
0
Comment
Question by:itbabe
3 Comments
 
LVL 14

Expert Comment

by:StillUnAware
ID: 16952136
see taskkill command
0
 
LVL 5

Expert Comment

by:shtson
ID: 16952378
Hai2u,

as StillUnAware said,

Sample 1: (by process name)
Public Sub Foo()
    Shell "TASKKILL /IM notepad.exe"
End Sub

Sample 2: (by process id)
Public Sub Foo()
    Shell "TASKKILL /PID 1283"
End Sub

Cheers,
Shai

0
 
LVL 2

Accepted Solution

by:
TiwariVikas earned 500 total points
ID: 16952782
TaskKill is a wonderful exe but it is not present in Win2000 or earlier.

Alternatively, you can use WMI to kill a process...

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colProcessList = objWMIService.ExecQuery _
    ("Select * from Win32_Process Where Name = 'Notepad.exe'")

For Each objProcess in colProcessList
    objProcess.Terminate()
Next

Regards,
Vikas.
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

I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

919 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

14 Experts available now in Live!

Get 1:1 Help Now