Solved

VBScript to close program

Posted on 2013-02-02
2
597 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
ID: 38846689
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
ID: 38846822
That works perfectly, thank you.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

756 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