Görev Yöneticisi İşlemleri
Çalışan işlemler Listesi
# get info dict about all running processes
import subprocess
output = subprocess.check_output(('TASKLIST', '/FO', 'CSV')).decode()
# get rid of extra " and split into lines
output = output.replace('"', '').split('rn')
keys = output[0].split(',')
proc_list = [i.split(',') for i in output[1:] if i]
# make dict with proc names as keys and dicts with the extra nfo as values
proc_dict = dict((i[0], dict(zip(keys[1:], i[1:]))) for i in proc_list)
for name, values in sorted(proc_dict.items(), key=lambda x: x[0].lower()):
print('%s: %s' % (name, values))
import subprocess
output = subprocess.check_output(('TASKLIST', '/FO', 'CSV')).decode()
# get rid of extra " and split into lines
output = output.replace('"', '').split('rn')
keys = output[0].split(',')
proc_list = [i.split(',') for i in output[1:] if i]
# make dict with proc names as keys and dicts with the extra nfo as values
proc_dict = dict((i[0], dict(zip(keys[1:], i[1:]))) for i in proc_list)
for name, values in sorted(proc_dict.items(), key=lambda x: x[0].lower()):
print('%s: %s' % (name, values))
Herhangi bir İşlemin çalışıp çalışmadığının kontrolü
import subprocess
def process_exists(process_name):
call = 'TASKLIST', '/FI', 'imagename eq %s' % process_name
# use buildin check_output right away
output = subprocess.check_output(call).decode()
# check in last line for process name
last_line = output.strip().split('rn')[-1]
# because Fail message could be translated
return last_line.lower().startswith(process_name.lower())
def Calisiyormu(Liste):
for L in Liste:
if(process_exists(L)):
print(L + " calisiyor")
else:
print(L +" Calismiyor")
Calisiyormu(['runplugin.exe', 'pcinssui.exe'])
def process_exists(process_name):
call = 'TASKLIST', '/FI', 'imagename eq %s' % process_name
# use buildin check_output right away
output = subprocess.check_output(call).decode()
# check in last line for process name
last_line = output.strip().split('rn')[-1]
# because Fail message could be translated
return last_line.lower().startswith(process_name.lower())
def Calisiyormu(Liste):
for L in Liste:
if(process_exists(L)):
print(L + " calisiyor")
else:
print(L +" Calismiyor")
Calisiyormu(['runplugin.exe', 'pcinssui.exe'])
Yorumunuzu Ekleyin