Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stopping a program on schedule

Status
Not open for further replies.

MarcusWendel

Technical User
Feb 22, 2002
41
SE
Hello all,

I'm looking for a way to schedule the shutdown of a specific program.
It's of course easy to schedule a program to start on a specific time, but in this case I need it to be stopped, some maintenance run and then the program restarted a while later (at a fixed time).

Any ideas on how to solve this problem? Thanks.

/Marcus
 
You can schedule a task that kills the process, but wouldn't be very ellegant.

Cheers,
Dian
 
you can try this one: this "loop" for win32_process will find only one item from the query (your_app.exe) and terminated it. you can copy, paste it on notepad, and save it as whatever.vbs (it's a vbs script).

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'your_app.exe'")

For Each objProcess in colProcessList
objProcess.Terminate()
Next
 
You could also try using AutoIt (
From the site:
AutoIt v3 is a freeware BASIC-like scripting language designed for automating the Windows GUI and general scripting. It uses a combination of simulated keystrokes, mouse movement and window/control manipulation in order to automate tasks in a way not possible or reliable with other languages (e.g. VBScript and SendKeys).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top