Solved

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

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
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…

757 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

24 Experts available now in Live!

Get 1:1 Help Now