Kill a named process in win2K not spawned by python

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • PoulsenL@capanalysis.com

    Kill a named process in win2K not spawned by python

    Can someone give me a clue how to rewrite this kludgy workaround in python?

    import os
    from win32pdhutil import *
    pid = FindPerformance AttributesByNam e("WINWORD")[0]
    os.system("C:\C MDUtils\kill " + str(pid))

    Thanks,

    Loren Poulsen

    --------------------------------------------------------------------------------------------------------------------
    This email and any attachments contain information from CapAnalysis, LLC, which may be confidential and/or privileged. The information is intended to be for the use of the individual or entity named on this email. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this email is prohibited. If you receive this email in error, please notify us by reply email immediately so that we can arrange for the retrieval of the original documents at no cost to you.

  • Syver Enstad

    #2
    Re: Kill a named process in win2K not spawned by python

    PoulsenL@capana lysis.com writes:
    [color=blue]
    > Can someone give me a clue how to rewrite this kludgy workaround in
    > python?
    >
    >
    > import os
    > from win32pdhutil import *
    > pid = FindPerformance AttributesByNam e("WINWORD")[0][/color]

    import win32process, win32api, win32con
    handle = win32api.OpenPr ocess(win32con. SYNCHRONIZE|win 32con.PROCESS_Q UERY_INFORMATIO N|win32con.PROC ESS_TERMINATE, 1, pid)
    win32api.Termin ateProcess(hand le, 1) # exit status


    --

    Vennlig hilsen

    Syver Enstad

    Comment

    Working...