View Single Post
Old Aug 2nd, 2006, 7:28 PM   #3
melbolt
Professional Programmer
 
melbolt's Avatar
 
Join Date: Feb 2005
Location: PA, USA
Posts: 253
Rep Power: 4 melbolt is on a distinguished road
oh, and you wanted to kill the process too.

vbnet Syntax (Toggle Plain Text)
  1. Option Explicit
  2. Dim objWMIService, objProcess, colProcess
  3. Dim strComputer, strProcessKill
  4. strComputer = "."
  5. strProcessKill = "'Filewatch.exe'"
  6.  
  7. Set objWMIService = GetObject("winmgmts:" _
  8. & "{impersonationLevel=impersonate}!\\" _
  9. & strComputer & "\root\cimv2")
  10.  
  11. Set colProcess = objWMIService.ExecQuery _
  12. ("Select * from Win32_Process Where Name = " & strProcessKill )
  13. For Each objProcess in colProcess
  14. objProcess.Terminate()
  15. Next
  16.  
  17. WScript.Quit

basically it queries running processes for the desired one and terminates it.

note: I'm not sure if this is being performed on the local machine or on a remote machine, the code above is for local, if you want to kill on remote machine, check the link below.

all this code was stolen from here, i take no credit but i did test them personally and they work
http://www.computerperformance.co.uk...ocess_stop.htm
__________________
I have never let my schooling interfere with my education. -Mark Twain-

Xbox live gamertag: melbolt
melbolt is offline   Reply With Quote