Scheduling Scripts on Windows (Task Scheduler)
Key idea
Section titled “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
Section titled “Practical advice”- Use a
.batfile that activates venv then runs the script - Log output to a file
Example batch file
Section titled “Example batch file”@echo off
cd /d C:\path\to\project
C:\path\to\venv\Scripts\python.exe my_script.py --source C:\datapch.coffeeTagline
pch.coffeeCtapch.feedbackHeading
pch.feedbackSubheading