?
Solved

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

Posted on 2006-06-21
3
Medium Priority
?
222 Views
Last Modified: 2010-04-17
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
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 2000 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

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.

Question has a verified solution.

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

Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
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 …
Six Sigma Control Plans

718 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