Solved

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

Posted on 2006-06-21
3
210 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
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 …

777 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