Solved

VBScript to close program

Posted on 2013-02-02
2
591 Views
Last Modified: 2013-02-02
Hi all,

I need to run a vbscript to close an application that I have running. I am planning on calling this vbscript from a scheduled task.
For some reason the taskkill wouldn't work for me in a batch file and so I'm looking now at vbscript as a solution. I am using Wndows 2008 R2.

Thanks in advance for your help.
0
Comment
Question by:oconnork00
2 Comments
 
LVL 6

Accepted Solution

by:
nickinthooz earned 500 total points
Comment Utility
try this:

Set objShell = CreateObject("WScript.Shell")
Set objWmi = GetObject("winmgmts:")


strWmiq = "select * from Win32_Process where name='iexplorer.exe'"
Set objQResult = objWmi.Execquery(strWmiq)


For Each objProcess In objQResult
intRet = objProcess.Terminate(1)
Next 

Open in new window


I haven't tried it myself
0
 
LVL 2

Author Comment

by:oconnork00
Comment Utility
That works perfectly, thank you.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Recently I finished a vbscript that I thought I'd share.  It uses a text file with a list of server names to loop through and get various status reports, then writes them all into an Excel file.  Originally it was put together for our Altiris server…
This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
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…

762 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

10 Experts available now in Live!

Get 1:1 Help Now