Jump to content

how to force process to close


Recommended Posts

If it is necessary for you to close process it is necessary to use ProcessClose ("process" [, flag]) where "process" - a name of an executed file (as a rule)...

See <Program Files Dir>\AutoIt3\AutoIt.chm

...

ProcessClose ( "process" [, flag] )

Parameters

process The title or PID of the process to terminate.

flag [optional] if different from zero will force closing of handles to child stream if any defined in the Run() execution. process must be defined as a PID.

Link to comment
Share on other sites

#include <Constants.au3>

$run = Run("taskkill /F /T /IM processnametokill.exe", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
While 1
    $line = StdoutRead($run)
    If @error Then ExitLoop
    MsgBox(0, "Sucessfull:", $line)
Wend

While 1
    $line = StderrRead($run)
    If @error Then ExitLoop
    MsgBox(0, "Error:", $line)
WEnd

Edited by mikiutama
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...