Hey Hugo, I've been reading through this thread because I need a way to kill a running EXE from within another EXE. I can't quite find where the solution is, even though this message was marked as such. Is there a full code block in here somewhere that shows how you do this? Also, it assumes I know the processID, but I'm not sure how to get that. Looking that up now, but wanted to get the message posted in case you are awake and bored... <g>
>Selim, did you try my method and did not work? It should work in W2K and WXP
>
>Try replacing
>
oShell.Run("TaskKill /PID " + ALLTRIM(STR(wlprocessid.ProcessId))
>with
>
KillProcess(wlprocessid.ProcessId)
>
>Doesn't this work? What is the error? It works fine for me.
>
>
>
>procedure KillProcess(tnProcessID)
>
>loCIMV2 = GetObject("winmgmts://localhost/root/cimv2")
>loProcesses = loCimv2.ExecQuery("SELECT * FROM Win32_Process WHERE ProcessId = " + alltrim(str(tnProcessID)))
>For Each objProcess in loProcesses
> objProcess.Terminate(0)
>Next
>return
>