I have three processes being opened and then i am killing all the three processes as follows:
import subprocess
DETACHED_PROCESS = 0x00000008
Process1 = subprocess.Popen("C:\learning\A.exe",creationflags=DETACHED_PROCESS,shell=True)
print"process id :",Process1.pid
Process2 = subprocess.Popen("D:\develop\B.exe", creationflags=DETACHED_PROCESS,shell=True)
print"process id :",Process2.pid
Process3 = subprocess.Popen("D:\testing\C.exe", creationflags=DETACHED_PROCESS,shell=True)
print"process id :",Process3.pid
terminate_process1 = subprocess.call(['taskkill', '/F', '/T', '/PID', A.exe])
terminate_process2 = subprocess.call(['taskkill', '/F', '/T', '/PID', B.exe])
terminate_process3 = subprocess.call(['taskkill', '/F', '/T', '/PID', C.exe])
I am getting the process id of all the three opened exe's , in the same manner i want to have the process id printed of the terminated processes, in order to confirm that that the processes which are opened are successfully terminated. When i run it on the command prompt i do get the process id terminated but if i run this script somewhere else e.g on python shell then i don't get the terminated process id's. So, suggest me way to get the terminated process id in the output printed.