Answer the question
In order to leave comments, you need to log in
Python how to terminate .exe process properly?
Hello.
I launch firefox shortcuts with the profiles I need, up to 10 pieces at the same time
. Now after a certain time they need to be completed, for example, the third profile, then the fifth, the first, etc.
I still have not figured it out.
I figured out how to kill all firefox.exe processes:
But the next time I start it, firefox writes that the work was not completed correctly and asks to start in safe mode.
With alt+f4, it doesn't swear at an incorrect shutdown.
The question is how to complete it correctly so that he does not swear?
And even better, how to complete a certain profile correctly?
os.startfile(f"profile{i}.lnk")
os.system("taskkill /im firefox.exe")
Answer the question
In order to leave comments, you need to log in
os.system("taskkill /im firefox.exe")
import subprocess as sp
sp.Popen('taskkill /im firefox.exe /f')
import psutil #pip isntall psutil
for proc in psutil.process_iter():
if proc.name() == 'firefox.exe':
proc.terminate()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question