I am writing a code but it has not worked as expected. A simplified version of the code is like this:
from subprocess import call
import time
call([r"C:\Windows\System32\notepad.exe"])
time.sleep(5)
call(["taskkill", "/im", "notepad.exe"])
When you run the script above, the code does not run from the line of the first call
, that is, the script opens the notepad and waits for a response of call([r"C:\Windows\System32\notepad.exe"])
, but this only happens when I manually close the notepad.
I would like the script to open the notepad, wait 5 seconds and close it, without manual user intervention. So, how can I do it?