{"id":567672,"date":"2019-07-17T15:33:59","date_gmt":"2019-07-17T22:33:59","guid":{"rendered":"https:\/\/www.esri.com\/arcgis-blog\/?post_type=blog&#038;p=567672"},"modified":"2019-07-18T09:11:45","modified_gmt":"2019-07-18T16:11:45","slug":"schedule-a-python-script-or-model-to-run-at-a-prescribed-time-2019-update","status":"publish","type":"blog","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/schedule-a-python-script-or-model-to-run-at-a-prescribed-time-2019-update","title":{"rendered":"Schedule a Python script or model to run at a prescribed time: 2019 update"},"author":8112,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"_acf_changed":false,"_searchwp_excluded":""},"categories":[23341],"tags":[27481,24331,216552,24341,437382],"industry":[],"product":[36561],"class_list":["post-567672","blog","type-blog","status-publish","format-standard","hentry","category-analytics","tag-automation","tag-modelbuilder","tag-productivity","tag-python","tag-task-scheduler","product-arcgis-pro"],"acf":{"short_description":"Automate your repetitive ArcGIS Pro workflows by running Python scripts in Windows Task Scheduler - a classic post revised for new software.","flexible_content":[{"acf_fc_layout":"content","content":"<p>In the history of the ArcGIS blog, a few posts have stood out as especially helpful to our readers. They\u2019ve continued to be popular over the years, but the software ecosystem has changed (hello, ArcGIS Pro!) and we decided some of them deserve a reboot.<\/p>\n"},{"acf_fc_layout":"image","image":{"ID":567732,"id":567732,"title":"sippingbird","filename":"sippingbird.png","filesize":14481,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/sippingbird.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/schedule-a-python-script-or-model-to-run-at-a-prescribed-time-2019-update\/sippingbird","alt":"Drinking bird","author":"8112","description":"","caption":"","name":"sippingbird","status":"inherit","uploaded_to":567672,"date":"2019-07-17 21:26:00","modified":"2019-07-17 21:26:59","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":126,"height":150,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/sippingbird.png","thumbnail-width":126,"thumbnail-height":150,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/sippingbird.png","medium-width":126,"medium-height":150,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/sippingbird.png","medium_large-width":126,"medium_large-height":150,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/sippingbird.png","large-width":126,"large-height":150,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/sippingbird.png","1536x1536-width":126,"1536x1536-height":150,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/sippingbird.png","2048x2048-width":126,"2048x2048-height":150,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/sippingbird.png","card_image-width":126,"card_image-height":150,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/sippingbird.png","wide_image-width":126,"wide_image-height":150}},"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<p>This is an updated version of Dale Honeycutt\u2019s 2013 post \u201c<a href=\"https:\/\/www.esri.com\/arcgis-blog\/products\/product\/analytics\/scheduling-a-python-script-or-model-to-run-at-a-prescribed-time\/\" target=\"_blank\" rel=\"noopener\">Scheduling a Python script or model to run at a prescribed time<\/a>.\u201d The title pretty much speaks for itself. If you have routine, lengthy processes you run with scripts or models, you can take your automation a step further and trigger the task at a specific time of day. Often this is done late at night or early in the morning, so when you arrive at your computer each day, the tedious stuff is already done for you.<\/p>\n<p>I\u2019ve modified and rearranged the original material to reflect ArcGIS Pro, Windows 10, and Python 3.<\/p>\n<h2>Starting with a script<\/h2>\n<p>In addition to this post, you should reference the <a href=\"https:\/\/pro.arcgis.com\/en\/pro-app\/help\/analysis\/geoprocessing\/modelbuilder\/scheduling-a-model-run.htm\" target=\"_blank\" rel=\"noopener\">Schedule a model<\/a> help topic.\u00a0Once you have your script ready (any script &#8211; it doesn\u2019t matter if it started out as a geoprocessing model) you can begin at the \u201cCreate a task\u201d section of the help topic. It will show you how to schedule a script to run using Windows Task Scheduler. The following sections of this post will also contain handy tips for getting started, so be sure to read on before you dive in!<\/p>\n<p>Note that the screenshots in this blog and on the help site currently show the 2019 version of Windows 10.<\/p>\n<h2>Starting with a model<\/h2>\n<p>On the other hand, if you\u2019d like to schedule a geoprocessing model to run at a specific time, you\u2019ll need to bring it into a script first, so start at the beginning of the help topic linked above. You won\u2019t need to export the model to a Python script \u2013 that\u2019s a common misconception. Instead, you can run the model from a script as you would any other geoprocessing tool. The key is the <code>ImportToolbox<\/code> function, which allows you to import the toolbox containing the model. The help topic includes a sample of how to do this with a very simple 3-line script.<\/p>\n<p>Note: Though it\u2019s not necessary here, it\u2019s still worth mentioning that in ArcGIS Pro 2.4 it\u2019s quite easy to <a href=\"https:\/\/pro.arcgis.com\/en\/pro-app\/help\/analysis\/geoprocessing\/modelbuilder\/exporting-a-model-to-python.htm\">export a model to Python<\/a>.<\/p>\n"},{"acf_fc_layout":"content","content":"<h1>Using Task Scheduler<\/h1>\n<p>To open Task Scheduler, use the Windows search bar. The\u00a0<strong>Actions<\/strong> pane, on the right, offers two options to create tasks. The help topic covers the <strong>Create Task<\/strong> option (which you\u2019ll likely end up using, as it offers more flexibility), but here we\u2019ll start by looking at the simpler <strong>Create Basic Task<\/strong> option. Both contain the same essential components, but <strong>Create Basic Task<\/strong> launches a wizard to walk you through the setup process.<\/p>\n"},{"acf_fc_layout":"image","image":{"ID":567752,"id":567752,"title":"taskSchedulerMain","filename":"taskSchedulerMain.png","filesize":29232,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/taskSchedulerMain.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/schedule-a-python-script-or-model-to-run-at-a-prescribed-time-2019-update\/taskschedulermain","alt":"Windows Task Scheduler","author":"8112","description":"","caption":"","name":"taskschedulermain","status":"inherit","uploaded_to":567672,"date":"2019-07-17 21:31:39","modified":"2019-07-17 21:31:53","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":624,"height":274,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/taskSchedulerMain-213x200.png","thumbnail-width":213,"thumbnail-height":200,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/taskSchedulerMain.png","medium-width":464,"medium-height":204,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/taskSchedulerMain.png","medium_large-width":624,"medium_large-height":274,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/taskSchedulerMain.png","large-width":624,"large-height":274,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/taskSchedulerMain.png","1536x1536-width":624,"1536x1536-height":274,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/taskSchedulerMain.png","2048x2048-width":624,"2048x2048-height":274,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/taskSchedulerMain.png","card_image-width":624,"card_image-height":274,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/taskSchedulerMain.png","wide_image-width":624,"wide_image-height":274}},"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<p>To start, launch the <strong>Create Basic Task<\/strong> wizard and click through, noting the essential steps (use fillers to get to the next page \u2013 you don\u2019t need to run a real task yet). First, you\u2019re asked to define the <em>name<\/em> of your task, then\u00a0the <em>trigger<\/em>\u00a0(when and how often it runs), and finally the\u00a0<em>action<\/em>\u00a0(which program to run \u2013 in this case, your script).<\/p>\n<p>If the wizard options meet your needs, great. If you require more flexibility, you\u2019ll find that the <strong>Create Tasks<\/strong> window is a better option. Alternatively, you can stick with the <strong>Create a Basic Task <\/strong>wizard and add any of the options offered by the <strong>Create Tasks<\/strong> window after creating the task: just highlight it in the task list and select <strong>Properties<\/strong> from the side panel.<\/p>\n<p>Whichever way you choose to configure your task, keep the following tips in mind when you specify the action.<\/p>\n<h2>Run the Python executable with arguments<\/h2>\n<p>To specify the action, you\u2019re given three fields to fill in. Intuitively, you might think to paste the path to your script in the \u201cProgram\/Script\u201d box, but this method comes with some pitfalls: namely, discrepancies with the login that Task Scheduler uses and confusion about which version of Python should be used in mixed environments (64 bit or 32 bit). To avoid this, we recommend that you run the Python executable as the program, with the name of your Python file in the optional argument field.<\/p>\n"},{"acf_fc_layout":"image","image":{"ID":567762,"id":567762,"title":"createbasictask","filename":"createbasictask.png","filesize":10576,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/createbasictask.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/schedule-a-python-script-or-model-to-run-at-a-prescribed-time-2019-update\/createbasictask","alt":"Action tab of Create Basic Task wizard","author":"8112","description":"","caption":"On the Action tab, you specify the Python script to run and any necessary arguments. ","name":"createbasictask","status":"inherit","uploaded_to":567672,"date":"2019-07-17 21:33:37","modified":"2019-07-17 21:34:22","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":624,"height":218,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/createbasictask-213x200.png","thumbnail-width":213,"thumbnail-height":200,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/createbasictask.png","medium-width":464,"medium-height":162,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/createbasictask.png","medium_large-width":624,"medium_large-height":218,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/createbasictask.png","large-width":624,"large-height":218,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/createbasictask.png","1536x1536-width":624,"1536x1536-height":218,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/createbasictask.png","2048x2048-width":624,"2048x2048-height":218,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/createbasictask.png","card_image-width":624,"card_image-height":218,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/createbasictask.png","wide_image-width":624,"wide_image-height":218}},"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<p>Suppose the script you want to run is\u00a0<code>E:\\My script.py<\/code>. Instead of running the script directly, instruct Task Scheduler to run\u00a0<code>python.exe<\/code>\u00a0with the script as an argument. In the command line, it would look like this:<\/p>\n<p><code>\"C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\python.exe\"<\/code> <code>\"E:\\My script.py\"<\/code><\/p>\n<p>The default location of\u00a0<code>python.exe<\/code>\u00a0in ArcGIS Pro is indicated in the example above, but it can vary depending on your install. If you want to verify or discover its location, copy and paste the following code into a new Python script and then execute the script. The script will print the location of\u00a0<code>python.exe<\/code>\u00a0as well as other information about your Python environment.<\/p>\n"},{"acf_fc_layout":"sidebar","content":"","image_reference":false,"layout":"code_snippet","image_reference_figure":"","snippet":"import sys\r\nimport platform\r\nimport importlib\r\nfrom pathlib import PureWindowsPath\r\n\r\nprint(\"Python EXE : \" + sys.executable + \"\\n\")\r\nprint(\"Architecture : \" + platform.architecture()[0] + \"\\n\")\r\nspec = importlib.util.find_spec(\"arcpy\")\r\nwindows_path = PureWindowsPath(str(spec.submodule_search_locations))\r\nprint(\"Path to ArcPy : \" + str(windows_path))\r\n","spotlight_name":"","section_title":"","position":"Center","spotlight_image":false},{"acf_fc_layout":"content","content":"<p>Once you\u2019re sure of the location of <code>python.exe<\/code> and your script, enter them into Task Scheduler as shown:<\/p>\n"},{"acf_fc_layout":"image","image":{"ID":567772,"id":567772,"title":"taskSchedulerWithScript","filename":"taskSchedulerWithScript.png","filesize":2889,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/taskSchedulerWithScript.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/schedule-a-python-script-or-model-to-run-at-a-prescribed-time-2019-update\/taskschedulerwithscript","alt":"Scheduling python.exe with script as argument","author":"8112","description":"","caption":"","name":"taskschedulerwithscript","status":"inherit","uploaded_to":567672,"date":"2019-07-17 21:49:11","modified":"2019-07-17 21:49:42","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":443,"height":139,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/taskSchedulerWithScript-213x139.png","thumbnail-width":213,"thumbnail-height":139,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/taskSchedulerWithScript.png","medium-width":443,"medium-height":139,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/taskSchedulerWithScript.png","medium_large-width":443,"medium_large-height":139,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/taskSchedulerWithScript.png","large-width":443,"large-height":139,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/taskSchedulerWithScript.png","1536x1536-width":443,"1536x1536-height":139,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/taskSchedulerWithScript.png","2048x2048-width":443,"2048x2048-height":139,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/taskSchedulerWithScript.png","card_image-width":443,"card_image-height":139,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/taskSchedulerWithScript.png","wide_image-width":443,"wide_image-height":139}},"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<p>Remember that if any of your paths or arguments contain spaces, you need to enclose the argument in double quotes. In the example above,\u00a0both paths contain spaces, so double quotes are required.<\/p>\n<p>If there are additional arguments (parameters) to your script, provide them after the path to your script. For example, the following command line executes a Python script that takes two arguments: the path to a feature class and an integer.<\/p>\n<p><code>\"C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\python.exe\"<\/code> <code>\"E:\\My Script.py\"<\/code> <code>C:\\Temp\\Work.gdb\\Campsites<\/code> <code>10<\/code><\/p>\n<p>In<em> most <\/em>cases, we recommend writing scripts to take arguments as in the above example, so that you don\u2019t have to edit the script to change the parameters. The alternative is to hard-code dataset paths or values within the script itself (in this example, that would mean the feature class and integer would be hard-coded). Scheduled scripts are a rare case where hard-coding can work to your advantage; opening and editing a script can be easier than editing the arguments of a task in Task Scheduler.<\/p>\n<p>If you\u2019d rather not hard-code your arguments, another option is to set up a task to run a Windows\u00a0batch file that in turn runs your script with arguments. (If you\u2019re not familiar with batch files, they\u2019re essentially a list of commands in a text file with the extension <code>.bat<\/code>. Here\u2019s a <a href=\"https:\/\/www.computerhope.com\/jargon\/b\/batchfil.htm\">better definition<\/a>). The batch file would contain the single command line shown above; this way, you could easily tweak parameters in a text editor without having to open Task Scheduler again.<\/p>\n<h2>Start simple<\/h2>\n<p>This recommendation comes from the author of the original version of this blog, who said he\u2019d started with scheduling a simple script to refresh his memory during the writing process. Here\u2019s my adaptation of Dale\u2019s script, which writes some information to a log file. During my own research and rewriting process, I set it up to run every five minutes for one hour. Earlier, I recommended that you step through the wizard to get a sense of what it asks for; now, try saving this script and using either the wizard or the <strong>Create Task<\/strong> option to run it at the time and frequency of your choosing. This process allows you to test changes to the script quickly, and you\u2019ll develop a better understanding of task scheduling before you try with a real script.<\/p>\n"},{"acf_fc_layout":"sidebar","content":"","image_reference":false,"layout":"code_snippet","image_reference_figure":"","snippet":"import sys\r\nimport time\r\nimport platform\r\nimport importlib\r\nfrom pathlib import PureWindowsPath\r\nprint(\"Importing arcpy... this may take a moment\")\r\nimport arcpy\r\n\r\n# Create and open a log file for writing\r\n\r\n# If you don't want the log file to be created directly on the C drive, replace \"C:\" below with the path to your desired directory.\r\nwith open(r\"C:\/schedule.log\",\"w\") as f:\r\n\r\n    # Write date and time\r\n    f.write(time.strftime(\"%x %X \\n\"))\r\n\r\n    # Test receiving of arguments\/parameters via arcpy (input some random parameter into task scheduler)\r\n    f.write(\"Parameter 0: \" + arcpy.GetParameterAsText(0) + \"\\n\")\r\n\r\n    # Python info\r\n    f.write(\"Python EXE : \" + sys.executable + \"\\n\")\r\n    f.write(\"Architecture : \" + platform.architecture()[0] + \"\\n\")\r\n    spec = importlib.util.find_spec(\"arcpy\")\r\n    windows_path = PureWindowsPath(str(spec.submodule_search_locations))\r\n    f.write(\"Path to ArcPy : \" + str(windows_path) + \"\\n\")\r\n","spotlight_name":"","section_title":"","position":"Center","spotlight_image":false},{"acf_fc_layout":"content","content":"<p>For clarification, the Action tab of Task Scheduler will look something like this:<\/p>\n"},{"acf_fc_layout":"image","image":{"ID":567792,"id":567792,"title":"tasksSchedAllParam","filename":"tasksSchedAllParam.png","filesize":5564,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/tasksSchedAllParam.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/schedule-a-python-script-or-model-to-run-at-a-prescribed-time-2019-update\/tasksschedallparam","alt":"Task Scheduler action tab with test script parameters","author":"8112","description":"","caption":"","name":"tasksschedallparam","status":"inherit","uploaded_to":567672,"date":"2019-07-17 21:53:55","modified":"2019-07-17 21:54:14","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":441,"height":184,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/tasksSchedAllParam-213x184.png","thumbnail-width":213,"thumbnail-height":184,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/tasksSchedAllParam.png","medium-width":441,"medium-height":184,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/tasksSchedAllParam.png","medium_large-width":441,"medium_large-height":184,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/tasksSchedAllParam.png","large-width":441,"large-height":184,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/tasksSchedAllParam.png","1536x1536-width":441,"1536x1536-height":184,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/tasksSchedAllParam.png","2048x2048-width":441,"2048x2048-height":184,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/tasksSchedAllParam.png","card_image-width":441,"card_image-height":184,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/tasksSchedAllParam.png","wide_image-width":441,"wide_image-height":184}},"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<p>And the contents of the log file will look something like this:<\/p>\n"},{"acf_fc_layout":"image","image":{"ID":567802,"id":567802,"title":"logFile","filename":"logFile.png","filesize":12453,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/logFile.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/schedule-a-python-script-or-model-to-run-at-a-prescribed-time-2019-update\/logfile","alt":"Log file in notepad","author":"8112","description":"","caption":"","name":"logfile","status":"inherit","uploaded_to":567672,"date":"2019-07-17 21:55:12","modified":"2019-07-17 21:55:24","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":624,"height":111,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/logFile-213x111.png","thumbnail-width":213,"thumbnail-height":111,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/logFile.png","medium-width":464,"medium-height":83,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/logFile.png","medium_large-width":624,"medium_large-height":111,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/logFile.png","large-width":624,"large-height":111,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/logFile.png","1536x1536-width":624,"1536x1536-height":111,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/logFile.png","2048x2048-width":624,"2048x2048-height":111,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/logFile.png","card_image-width":624,"card_image-height":111,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/logFile.png","wide_image-width":624,"wide_image-height":111}},"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<h2>Take it further<\/h2>\n<p>Now that you\u2019re comfortable with Windows Task Scheduler, setting up your essential, routine tasks should be straightforward. But be sure to take some time to experiment with Task Scheduler and read the <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/desktop\/taskschd\/task-scheduler-start-page\">Windows help<\/a>. We\u2019ve barely scratched the surface here, and there\u2019s much more you can do for your GIS workflows and beyond.<\/p>\n<p><em>Ghislain Prince contributed to this post<\/em><\/p>\n"}],"authors":[{"ID":8112,"user_firstname":"Olivia","user_lastname":"Iannone","nickname":"OIannone","user_nicename":"oiannone","display_name":"Olivia Iannone","user_email":"OIannone@esri.com","user_url":"","user_registered":"2018-06-22 21:48:46","user_description":"I'm a technical writer for ArcGIS Pro who came to Esri after my wildlife biology studies exposed me to the power of GIS. I'm fascinated by how communicating creatively with data connects people to places, and committed to providing ArcGIS Pro users with the information they need to succeed. When I'm not at work, I love to ski, travel, or do anything else that gets me outdoors.","user_avatar":"<img data-del=\"avatar\" src='https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/20190107_165036-213x200.jpg' class='avatar pp-user-avatar avatar-96 photo ' height='96' width='96'\/>"}],"related_articles":"","card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/card-1.jpg","wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/clocks.jpg"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.9 (Yoast SEO v25.9) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Schedule a Python script or model to run at a prescribed time: 2019 update<\/title>\n<meta name=\"description\" content=\"Learn how to automate your repetitive ArcGIS Pro workflows by running Python scripts in Windows Task Scheduler.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/schedule-a-python-script-or-model-to-run-at-a-prescribed-time-2019-update\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Schedule a Python script or model to run at a prescribed time: 2019 update\" \/>\n<meta property=\"og:description\" content=\"Learn how to automate your repetitive ArcGIS Pro workflows by running Python scripts in Windows Task Scheduler.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/schedule-a-python-script-or-model-to-run-at-a-prescribed-time-2019-update\" \/>\n<meta property=\"og:site_name\" content=\"ArcGIS Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/esrigis\/\" \/>\n<meta property=\"article:modified_time\" content=\"2019-07-18T16:11:45+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@ESRI\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":[\"Article\",\"BlogPosting\"],\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/schedule-a-python-script-or-model-to-run-at-a-prescribed-time-2019-update#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/schedule-a-python-script-or-model-to-run-at-a-prescribed-time-2019-update\"},\"author\":{\"name\":\"Olivia Iannone\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/54fdb9030f5a49100e0c0f41afe93b32\"},\"headline\":\"Schedule a Python script or model to run at a prescribed time: 2019 update\",\"datePublished\":\"2019-07-17T22:33:59+00:00\",\"dateModified\":\"2019-07-18T16:11:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/schedule-a-python-script-or-model-to-run-at-a-prescribed-time-2019-update\"},\"wordCount\":13,\"publisher\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#organization\"},\"keywords\":[\"Automation\",\"ModelBuilder\",\"Productivity\",\"python\",\"task scheduler\"],\"articleSection\":[\"Analytics\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/schedule-a-python-script-or-model-to-run-at-a-prescribed-time-2019-update\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/schedule-a-python-script-or-model-to-run-at-a-prescribed-time-2019-update\",\"name\":\"Schedule a Python script or model to run at a prescribed time: 2019 update\",\"isPartOf\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#website\"},\"datePublished\":\"2019-07-17T22:33:59+00:00\",\"dateModified\":\"2019-07-18T16:11:45+00:00\",\"description\":\"Learn how to automate your repetitive ArcGIS Pro workflows by running Python scripts in Windows Task Scheduler.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/schedule-a-python-script-or-model-to-run-at-a-prescribed-time-2019-update#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/schedule-a-python-script-or-model-to-run-at-a-prescribed-time-2019-update\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/schedule-a-python-script-or-model-to-run-at-a-prescribed-time-2019-update#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.esri.com\/arcgis-blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Schedule a Python script or model to run at a prescribed time: 2019 update\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#website\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/\",\"name\":\"ArcGIS Blog\",\"description\":\"Get insider info from Esri product teams\",\"publisher\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.esri.com\/arcgis-blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#organization\",\"name\":\"Esri\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png\",\"contentUrl\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png\",\"width\":400,\"height\":400,\"caption\":\"Esri\"},\"image\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/esrigis\/\",\"https:\/\/x.com\/ESRI\",\"https:\/\/www.linkedin.com\/company\/5311\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/54fdb9030f5a49100e0c0f41afe93b32\",\"name\":\"Olivia Iannone\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/20190107_165036-213x200.jpg\",\"contentUrl\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/20190107_165036-213x200.jpg\",\"caption\":\"Olivia Iannone\"},\"description\":\"I'm a technical writer for ArcGIS Pro who came to Esri after my wildlife biology studies exposed me to the power of GIS. I'm fascinated by how communicating creatively with data connects people to places, and committed to providing ArcGIS Pro users with the information they need to succeed. When I'm not at work, I love to ski, travel, or do anything else that gets me outdoors.\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/author\/oiannone\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Schedule a Python script or model to run at a prescribed time: 2019 update","description":"Learn how to automate your repetitive ArcGIS Pro workflows by running Python scripts in Windows Task Scheduler.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/schedule-a-python-script-or-model-to-run-at-a-prescribed-time-2019-update","og_locale":"en_US","og_type":"article","og_title":"Schedule a Python script or model to run at a prescribed time: 2019 update","og_description":"Learn how to automate your repetitive ArcGIS Pro workflows by running Python scripts in Windows Task Scheduler.","og_url":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/schedule-a-python-script-or-model-to-run-at-a-prescribed-time-2019-update","og_site_name":"ArcGIS Blog","article_publisher":"https:\/\/www.facebook.com\/esrigis\/","article_modified_time":"2019-07-18T16:11:45+00:00","twitter_card":"summary_large_image","twitter_site":"@ESRI","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["Article","BlogPosting"],"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/schedule-a-python-script-or-model-to-run-at-a-prescribed-time-2019-update#article","isPartOf":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/schedule-a-python-script-or-model-to-run-at-a-prescribed-time-2019-update"},"author":{"name":"Olivia Iannone","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/54fdb9030f5a49100e0c0f41afe93b32"},"headline":"Schedule a Python script or model to run at a prescribed time: 2019 update","datePublished":"2019-07-17T22:33:59+00:00","dateModified":"2019-07-18T16:11:45+00:00","mainEntityOfPage":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/schedule-a-python-script-or-model-to-run-at-a-prescribed-time-2019-update"},"wordCount":13,"publisher":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#organization"},"keywords":["Automation","ModelBuilder","Productivity","python","task scheduler"],"articleSection":["Analytics"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/schedule-a-python-script-or-model-to-run-at-a-prescribed-time-2019-update","url":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/schedule-a-python-script-or-model-to-run-at-a-prescribed-time-2019-update","name":"Schedule a Python script or model to run at a prescribed time: 2019 update","isPartOf":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#website"},"datePublished":"2019-07-17T22:33:59+00:00","dateModified":"2019-07-18T16:11:45+00:00","description":"Learn how to automate your repetitive ArcGIS Pro workflows by running Python scripts in Windows Task Scheduler.","breadcrumb":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/schedule-a-python-script-or-model-to-run-at-a-prescribed-time-2019-update#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/schedule-a-python-script-or-model-to-run-at-a-prescribed-time-2019-update"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/schedule-a-python-script-or-model-to-run-at-a-prescribed-time-2019-update#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.esri.com\/arcgis-blog\/"},{"@type":"ListItem","position":2,"name":"Schedule a Python script or model to run at a prescribed time: 2019 update"}]},{"@type":"WebSite","@id":"https:\/\/www.esri.com\/arcgis-blog\/#website","url":"https:\/\/www.esri.com\/arcgis-blog\/","name":"ArcGIS Blog","description":"Get insider info from Esri product teams","publisher":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.esri.com\/arcgis-blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.esri.com\/arcgis-blog\/#organization","name":"Esri","url":"https:\/\/www.esri.com\/arcgis-blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png","contentUrl":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png","width":400,"height":400,"caption":"Esri"},"image":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/esrigis\/","https:\/\/x.com\/ESRI","https:\/\/www.linkedin.com\/company\/5311\/"]},{"@type":"Person","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/54fdb9030f5a49100e0c0f41afe93b32","name":"Olivia Iannone","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/image\/","url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/20190107_165036-213x200.jpg","contentUrl":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/20190107_165036-213x200.jpg","caption":"Olivia Iannone"},"description":"I'm a technical writer for ArcGIS Pro who came to Esri after my wildlife biology studies exposed me to the power of GIS. I'm fascinated by how communicating creatively with data connects people to places, and committed to providing ArcGIS Pro users with the information they need to succeed. When I'm not at work, I love to ski, travel, or do anything else that gets me outdoors.","url":"https:\/\/www.esri.com\/arcgis-blog\/author\/oiannone"}]}},"text_date":"July 17, 2019","author_name":"Olivia Iannone","author_page":"https:\/\/www.esri.com\/arcgis-blog\/author\/oiannone","custom_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/clocks.jpg","primary_product":"ArcGIS Pro","tag_data":[{"term_id":27481,"name":"Automation","slug":"automation","term_group":0,"term_taxonomy_id":27481,"taxonomy":"post_tag","description":"","parent":0,"count":38,"filter":"raw"},{"term_id":24331,"name":"ModelBuilder","slug":"modelbuilder","term_group":0,"term_taxonomy_id":24331,"taxonomy":"post_tag","description":"","parent":0,"count":28,"filter":"raw"},{"term_id":216552,"name":"Productivity","slug":"productivity","term_group":0,"term_taxonomy_id":216552,"taxonomy":"post_tag","description":"","parent":0,"count":10,"filter":"raw"},{"term_id":24341,"name":"python","slug":"python","term_group":0,"term_taxonomy_id":24341,"taxonomy":"post_tag","description":"","parent":0,"count":171,"filter":"raw"},{"term_id":437382,"name":"task scheduler","slug":"task-scheduler","term_group":0,"term_taxonomy_id":437382,"taxonomy":"post_tag","description":"","parent":0,"count":2,"filter":"raw"}],"category_data":[{"term_id":23341,"name":"Analytics","slug":"analytics","term_group":0,"term_taxonomy_id":23341,"taxonomy":"category","description":"","parent":0,"count":1328,"filter":"raw"}],"product_data":[{"term_id":36561,"name":"ArcGIS Pro","slug":"arcgis-pro","term_group":0,"term_taxonomy_id":36561,"taxonomy":"product","description":"","parent":0,"count":2036,"filter":"raw"}],"primary_product_link":"https:\/\/www.esri.com\/arcgis-blog\/?s=#&products=arcgis-pro","_links":{"self":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/blog\/567672","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/blog"}],"about":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/types\/blog"}],"author":[{"embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/users\/8112"}],"replies":[{"embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/comments?post=567672"}],"version-history":[{"count":0,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/blog\/567672\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/media?parent=567672"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/categories?post=567672"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/tags?post=567672"},{"taxonomy":"industry","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/industry?post=567672"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/product?post=567672"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}