Scheduling Scripts on Windows (Task Scheduler)
Key idea
Task Scheduler runs your script in a different environment than your terminal.
Be explicit about:
- Python executable path
- script path
- working directory
Practical advice
- Use a
.bat.batfile that activates venv then runs the script - Log output to a file
Example batch file
@echo off
cd /d C:\path\to\project
C:\path\to\venv\Scripts\python.exe my_script.py --source C:\data@echo off
cd /d C:\path\to\project
C:\path\to\venv\Scripts\python.exe my_script.py --source C:\dataIf this helped you, consider buying me a coffee ☕
Buy me a coffeeWas this page helpful?
Let us know how we did
