Getting PID for process

H

Harlin Seritt

Let's say I have a simple script on Windows NT. I would like for that
script to find its own PID once it's started and store that as a value
within the script. Also, down the road I'd like to kill that process by
its PID. How is this done?

Thanks,

Harlin Seritt
 
J

John Abel

try:

import os

myPID = os.getpid()

So you can kill it at a later date, it would be worth writing that out
to a file somewhere - C:\temp? I'm sure you can get a kill command for
Win32.

HTH

J
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top