Oct-07-2018, 08:11 AM
hello all ...
im coding a program to get the internet browsers names and dir's from the windows if he found the process ...
this is my code :
qassam = os.popen("dir /s /b {}".format(lists[1])).read().strip()
print qassam
dir1 = os.path.dirname(qassam)
print dir1
if he did not found any browser just print found nothing
im coding a program to get the internet browsers names and dir's from the windows if he found the process ...
this is my code :
import os import time def q(): home = os.environ.get("HOMEDRIVE") lol =home +"/" mycurrent = os.getcwd() change = os.chdir(lol) mycurrent = os.getcwd() d = os.popen("""wmic process get name | findstr /v "Name 'System Idle Process' System""").read().lower() lists = ["opera.exe" , "chrome.exe" , "iexplore.exe" , "firefox.exe" , "microsoftedgecp.exe"] for q in lists: if any(item in q for item in d) : qassam = os.popen("dir /s /b {}".format(lists[1])).read().strip() print qassam dir1 = os.path.dirname(qassam) print dir1 #CreateShortCut_to_Desktop(qassam , dir1) print time.time() else: print "nothing found" break q()the d variable run this command (wmic process get name | findstr /v "Name 'System Idle Process' System) on the system to get all the process ... i need to modify the code search in this process if he found any item from list name lists[] then run this lines :
qassam = os.popen("dir /s /b {}".format(lists[1])).read().strip()
print qassam
dir1 = os.path.dirname(qassam)
print dir1
if he did not found any browser just print found nothing