How to run a python script in the background on windows
A quick intro to pythonw
1 min readMay 24, 2020
When I first started using python, I though that you had to have the command prompt open for the script to be running. Then, I found out about pythonw.exe. Pythonw runs your python programs in the background even after you close the command prompt window.
Using pythonw
Just change the file extension of your python script from .py to .pyw and that’s it! Now, just double click the newly named .pyw file and it will run in the background.
Terminating the program
If you want to close the python program, you can just do it with taskkill.
TASKKILL /F /IM pythonw.exe