<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Alejandro Bautista R.</title>
    <description>The latest articles on DEV Community by Alejandro Bautista R. (@abautista).</description>
    <link>https://dev.to/abautista</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F239734%2Feac8b701-b27e-4cd4-bf35-8f033fe7d20c.jpeg</url>
      <title>DEV Community: Alejandro Bautista R.</title>
      <link>https://dev.to/abautista</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/abautista"/>
    <language>en</language>
    <item>
      <title>Automate a python script with Task Scheduler</title>
      <dc:creator>Alejandro Bautista R.</dc:creator>
      <pubDate>Tue, 03 Dec 2019 05:42:25 +0000</pubDate>
      <link>https://dev.to/abautista/automate-a-python-script-with-task-scheduler-3fb6</link>
      <guid>https://dev.to/abautista/automate-a-python-script-with-task-scheduler-3fb6</guid>
      <description>&lt;p&gt;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). &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steps&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Open the Task Scheduler and click on the Task Scheduler Library to see the current tasks that are executed. Click on the &lt;code&gt;Create Task&lt;/code&gt; option from the &lt;code&gt;Task scheduler library&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0FzRRQn0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.stack.imgur.com/8IZpn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0FzRRQn0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.stack.imgur.com/8IZpn.png" alt="Task scheduler options"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wyASVc7---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.stack.imgur.com/VsBuk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wyASVc7---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.stack.imgur.com/VsBuk.png" alt="User options"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the Actions tab, click on the &lt;code&gt;New button&lt;/code&gt; and type in the following:&lt;/p&gt;

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

&lt;p&gt;In Add arguments (optional) you need to type the name of your python script. In my case, the path was:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    `Permissions_dump.py`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;In Start in (optional) you need to type the path of the file but without the name of the python script, that is:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;C:\Users\userX\PycharmProjects\1099_vendors_costs&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0AwxquQU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.stack.imgur.com/XAORA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0AwxquQU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.stack.imgur.com/XAORA.png" alt="Edit options"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on the &lt;code&gt;Triggers&lt;/code&gt; tab and select how often you want to execute this task.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LcaZGn38--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.stack.imgur.com/SSkLH.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LcaZGn38--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.stack.imgur.com/SSkLH.png" alt="Triggers"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Lastly, test your task to see if it truly works by selecting it from the Task Scheduler Library and doing click on the &lt;code&gt;Run&lt;/code&gt; option.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mglsqVmp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.stack.imgur.com/lo4Rq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mglsqVmp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.stack.imgur.com/lo4Rq.png" alt="Task Scheduler Library"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hope this helps to anyone who is interested to know how to automate simple Python scripts :)&lt;/p&gt;

</description>
      <category>python</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
