Solved

VBScript to close program

Posted on 2013-02-02
2
608 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
[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
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

617 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