Answer the question
In order to leave comments, you need to log in
Python run and then check the status of a bat file?
I'm trying to run the bat file and check its performance on the server, but I just can't enter the condition correctly.
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)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question