Skip to content

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.bat file 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:\data

If this helped you, consider buying me a coffee ☕

Buy me a coffee

Was this page helpful?

Let us know how we did