Sign in to follow this  
Followers 0
Guest gcyeaw

ProcessClose

8 posts in this topic

I compiled the following, pretty much a cut and paste of the example with a different process name. When I execute it, it obtains the PID and follows the 'then' leg of the if statement. It displays the PID in the message box, but the process is not closed. What am I missing here?

Windows XP SP2

$PID = ProcessExists("X10nets.exe") ; Will return the PID or 0 if the process isn't found.

if $PID Then

ProcessClose($PID)

MsgBox(4096, $PID, "This box will time out in 5 seconds", 5)

else

MsgBox(4096, "X10nets did not exist", "This box will time out in 5 seconds", 5)

endif

Share this post


Link to post
Share on other sites



Open task manager and see if the target process to kill is running with a username of "SYSTEM" or "NETWORK SERVICE". If it is, then you may not be able to kill it using autoit unless autoit has the correct admin rights.


Who else would I be?

Share this post


Link to post
Share on other sites

Hi,

I've got the same problem. Is there a way around? I mean, AutoIt is run as Administrator, so how much more rights can it have? I'm logged in as Administrator too and can easily kill the process in question. So how do I allow AutoIt to do it?

Best regards

Thomas Bartz

Share this post


Link to post
Share on other sites

Have you tried a loop with a sleep to give the process time to die?

Not sure if this will help, had to something similiar with other scripts

example:

$PID = ProcessExists("X10nets.exe") ; Will return the PID or 0 if the process isn't found.

While($PID)

ProcessClose($PID)

Sleep ( 1000 )

$PID = ProcessExists("X10nets.exe") ; Will return the PID or 0 if the process isn't found.

if $PID Then

MsgBox(4096, $PID, "This box will time out in 5 seconds", 5)

else

MsgBox(4096, "X10nets.exe did not exist", "This box will time out in 5 seconds", 5)

endif

Wend


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Have you tried a loop with a sleep to give the process time to die?

Not sure if this will help, had to something similiar with other scripts

No, but the process isn't closing, even if I watch at the taskmanager after running my script :idiot: It really seems, that ProcessClose can't kill all kind of processes und doesn't give any feedback about it.

While searching on in the forum I found the hint to use "taskkill", which serves my needs very well. So if anyone else has got the same problem again, he should try to use the following:

Run(@ComSpec & " /c taskkill /IM wmiprvse.exe /F")

Thanks for your help

Best regards

Thomas

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Thats it Toba 'ProcessClose' does not KILL processes, just close them in the kind way. If a process don't want to close 'ProcessClose' will not close it.

Solution, use a external utility called 'Pskill', is a command line utility easy to implement in a script and it is much stronger even that the usual Task Manage 'End Process'.

Link to PSline homepage

Ops... I arrived late. Well... Pskill maybe useful when you are not using WinXP systems. :idiot:

Edited by ezzetabi

Share this post


Link to post
Share on other sites

Window XP Pro has Taskkill.

Windows XP Home does not have Taskkill, so PSKill is good recommendation then.

:idiot:

Share this post


Link to post
Share on other sites

I've got the same problem. Is there a way around? I mean, AutoIt is run as Administrator, so how much more rights can it have? I'm logged in as Administrator too and can easily kill the process in question. So how do I allow AutoIt to do it?

Members of the Administrators group don't have full rights. On windows the simplest way would be to create a service, start this service and let it do its task (the ProcessClose) and then removing the service again. That's what pskill does and that's pretty much the only way I know about to close a program not running as your user.

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