import psutil
import time
import os
from psutil import Popen
procname = 'conhost.exe'
list = []
for proc in psutil.process_iter():
pinfo = proc.as_dict(attrs=['pid', 'name'])
list.append(pinfo['name'])
while(1):
if not list == procname:
os.startfile('file.bat')
time.sleep(10)