Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Schedule Python Script - Windows 7

I have a python script which I would like to run at regular intervals. I am running windows 7. What is the best way to accomplish this? Easiest way?

like image 749
Btibert3 Avatar asked Apr 27 '10 23:04

Btibert3


People also ask

How do I schedule a Python script in Windows?

In order to schedule the Python script using the Windows Scheduler: Open the Windows Control Panel and then click on the Administrative Tools. Double-click on the Task Scheduler, and then choose the option to 'Create Basic Task…' Type a name for your task (you can also type a description if needed), and then press Next ...


1 Answers

You can do it in the command line as follows:

schtasks /Create /SC HOURLY /TN PythonTask /TR "PATH_TO_PYTHON_EXE PATH_TO_PYTHON_SCRIPT" 

That will create an hourly task called 'PythonTask'. You can replace HOURLY with DAILY, WEEKLY etc. PATH_TO_PYTHON_EXE will be something like: C:\python25\python.exe. Check out more examples by writing this in the command line:

schtasks /? 

Otherwise you can open the Task Scheduler and do it through the GUI. Hope this helps.

like image 157
Glen Robertson Avatar answered Sep 22 '22 12:09

Glen Robertson