DEV Community

Alejandro Bautista R.
Alejandro Bautista R.

Posted on • Originally published at stackoverflow.com

Automate a python script with Task Scheduler

The following is a brief tutorial that makes possible to automate the execution a python script with the Windows Task Scheduler (Windows 7, 8 and 10).

Steps

Open the Task Scheduler and click on the Task Scheduler Library to see the current tasks that are executed. Click on the Create Task option from the Task scheduler library.

Task scheduler options

In the General tab, put the name of your new task and click on the option Run whether user is logged on or not, check the option Run with highest privileges and make sure to setup the appropriate version of you OS.

User options

In the Actions tab, click on the New button and type in the following:

In Program/Scripts you need to look up for the Python.exe path that the Task Scheduler will invoke to run the python script. In my case, my Python.exe path was: C:\Users\userX\python.exe.

In Add arguments (optional) you need to type the name of your python script. In my case, the path was:

    `Permissions_dump.py`
Enter fullscreen mode Exit fullscreen mode

In Start in (optional) you need to type the path of the file but without the name of the python script, that is:

C:\Users\userX\PycharmProjects\1099_vendors_costs

Edit options

Click on the Triggers tab and select how often you want to execute this task.

Triggers

Lastly, test your task to see if it truly works by selecting it from the Task Scheduler Library and doing click on the Run option.

Task Scheduler Library

Hope this helps to anyone who is interested to know how to automate simple Python scripts :)

Top comments (0)