Killing a process

G

Grodon

I'm trying to set up a job to kill a running application
every night, before our database backups run. Is there a
way to do this?

Thanks in adv.
Grodon
 
M

Mark V

In said:
I'm trying to set up a job to kill a running application
every night, before our database backups run. Is there a
way to do this?

MS Resource Kit, Support Tools (or possible present already): kill.exe

One 3rd-party tool: pskill.exe (www.sysinternals.com)

Don't kill Services. STOP (or pause possibly) them instead.
 
D

Dave Patrick

This may help. Save file as VBS
Replace 'excel.exe' for your process.
-------------------------------------
Set objWMIService = GetObject("winmgmts:" & _
"{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colProcessList = objWMIService.ExecQuery ("Select " & _
"* from Win32_Process Where Name = 'excel.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next
Set fso = Nothing
Set objWMIService = Nothing
Set colProcessList = Nothing
-------------------------------------

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

:
| I'm trying to set up a job to kill a running application
| every night, before our database backups run. Is there a
| way to do this?
|
| Thanks in adv.
| Grodon
 
P

Paul R. Sadowski [MVP]

Grodon said:
I'm trying to set up a job to kill a running application
every night, before our database backups run. Is there a
way to do this?

On XP there's also taskkill (Pro) and tskill (Home) though I prefer using
WMI myself since most of my backup scripts are WSH anyway.

:: Kill running instances of Outlook
%WINDIR%\System32\taskkill.exe /F /IM OUTLOOK.EXE > nul 2>&1
:: in xp home use (tskill uses the process name not an image name)
:: %WINDIR%\System32\tskill.exe outlook > nul 2>&1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top