May-29-2022, 09:11 AM
You don't give full path when shall close the process.
It's only name
Don't need
It's only name
vlc.exe
or PID.Don't need
"\"
before the path.import subprocess subprocess.Popen([r"C:\Program Files\VideoLAN\VLC\vlc.exe"])Kill💀
import subprocess process = subprocess.run("taskkill /im vlc.exe", capture_output=True, encoding='utf-8') print(process.stdout)
Output:SUCCESS: Sent termination signal to the process "vlc.exe" with PID 21356.