Sign in to follow this  
Followers 0
ChrisL

Process Close

12 posts in this topic

Anyone noticed that process close doesn't always work very well?

Iv'e used it to close a remote control program but it doesn't seem very reliable, I have called PSKILL instead which works every time, is this a floor in the way AutoIT closes processes, could or should it have the ability to kill a process like PS tools?

Any thoughts

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Maybe.....

WinClose()

or

WinKill()

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

AutoIt uses TerminateProcess(), too.

Share this post


Link to post
Share on other sites

I always do this

$pid=Run("Notepad.exe")
While ProcessExists($pid) Then
    ProcessClose($pid)
WEnd

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

I have not once needed to resort to a loop to close a proess. If I did, a For loop would always be chosen 1st. Most processes will close but some very few may refuse. I would assume that the process in the 1st post ignores a shutdown message for the sake of security? I do not like the idea of killimg processes dead in their tracks unless they are malicous to start with. ProcessClose() seems to do ok by my vote. B)

Edited by MHz

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

Well, if it is sometimes fails with this process then try this loop. Change the ?.exe to your process.

For $i = 1 To 5
    If ProcessExists('?.exe') Then
        ProcessClose('?.exe')
        Sleep(1000)
    Else
        ExitLoop
    EndIf
Next

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0