{"id":4754,"date":"2021-08-04T04:31:47","date_gmt":"2021-08-04T04:31:47","guid":{"rendered":"https:\/\/studysection.com\/blog\/?p=4754"},"modified":"2021-08-04T04:58:24","modified_gmt":"2021-08-04T04:58:24","slug":"schedule-python-script-using-windows-scheduler","status":"publish","type":"post","link":"https:\/\/studysection.com\/blog\/schedule-python-script-using-windows-scheduler\/","title":{"rendered":"Schedule Python Script Using Windows Scheduler"},"content":{"rendered":"<p>In this tutorial, you will learn how to schedule Python scripts through Windows Scheduler.<br \/>\nSometimes, you need to call an API after a specific interval of time. For example, if you want to<br \/>\nexecute a Python script every hour in a Windows machine, then you need to use Windows Scheduler.<\/p>\n<p><strong>Steps:<\/strong> Here are steps to schedule a Python <a href=\"https:\/\/studysection.com\/blog\/javascript\/\">script<\/a> using Windows Scheduler.<\/p>\n<ol>\n<li>First, you need to prepare a Python script that you need to execute.<br \/>\nIn our example, I\u2019ll use the script to display the label <strong>\u2018Hello World!.\u2019<\/strong><br \/>\n<img decoding=\"async\" src=\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/08\/print.png\" alt=\"print\"\/>\n<\/li>\n<li>Once you\u2019re done writing the script, save it as a Python file (which should have the <strong>.py<\/strong> file type):<\/li>\n<li>After that, you need to create a batch file to run the Python script. That contains<br \/>\n<code>\"Python exe path  stored in system \\python.exe\" \"Python script path stored \\script name.py\"<\/code><br \/>\nIn my case<\/p>\n<ul>\n<li><strong>Path of Python exe<\/strong> is:<br \/>\n\u201cC:\\Users\\ComputerName\\AppData\\Local\\Programs\\Python\\Python37-32\\python.exe\u201d<\/li>\n<li><strong>Path of Python script<\/strong> is, (see step-2):<br \/>\n\u201cC:\\Users\\ComputerName\\Desktop\\Hello_World.py\u201d<br \/>\n<img decoding=\"async\" src=\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/08\/path.png\" alt=\"path\"\/>\n<\/li>\n<\/ul>\n<\/li>\n<li>Save this file with a <strong>.bat<\/strong> extension. Like <strong>FileName.bat<\/strong><\/li>\n<li>Additionally, You need to add a <strong>pause <\/strong>command at the end of the bat file. It will keep the command line open until the key action will be performed by the user.<\/li>\n<li>Schedule Python Script using Windows Scheduler<br \/>\nFor this step, I\u2019m using Windows 10 to execute the Python Script via the Windows Task Scheduler. Open Control Panel after that click on Administrative Tools:<br \/>\n<img decoding=\"async\" src=\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/08\/control-panel.png\" alt=\"Windows\"\/><\/br><br \/>\nThen click on Task Scheduler to create basic tasks<br \/>\n<img decoding=\"async\" src=\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/08\/tools.png\" alt=\"Windows tools\"\/><\/br><br \/>\nThen click on<br \/>\n<img decoding=\"async\" src=\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/08\/actions.png\" alt=\"Windows actions\" \/><\/br><br \/>\nType a name for your task (you can type any description), and then press Next.<br \/>\nI have named the task as Run Hello World<br \/>\n<img decoding=\"async\" src=\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/08\/task.png\" alt=\"Windows task\"\/><\/br><br \/>\nNext, I chose to start the task \u2018Daily\u2019 since we wish to run the Python script daily at 6 am:<br \/>\n<img decoding=\"async\" src=\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/08\/trigger.png\" alt=\"Windows trigger\" \/><\/br><br \/>\nAfter that Fill in the Start Date and Time.<br \/>\n<img decoding=\"async\" src=\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/08\/shedual.png\" alt=\"shedual\"\/><\/br><br \/>\nThe action will then recur every day at 6 am, starting from 2021-04-12.<br \/>\n<img decoding=\"async\" src=\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/08\/action.png\" alt=\"action\"\/><\/br><br \/>\nSelect, Start a program, and then press Next:<br \/>\nAfter that, add the path of your batch file<br \/>\n<img decoding=\"async\" src=\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/08\/program.png\" alt=\"program\"\/><\/br><br \/>\nThen click next and press the Finish Button<br \/>\n<img decoding=\"async\" src=\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/08\/basic-task.png\" alt=\"Finish\"\/><\/br><br \/>\nFrom now, the Python script will run every day at 06:00 AM.<br \/>\nNote: You can edit the scheduler according to your need at any time.\n<\/li>\n<\/ol>\n<p><small><em>The English language is the most widely used language as a medium of communication around the world. Having a certification for the English language can be an advantage. StudySection provides an <a href=\"https:\/\/www.studysection.com\/english-language-advanced-diploma\">English Certification Exam<\/a> that tests English language proficiency in English grammar, reading, and writing.<\/em><\/small><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you will learn how to schedule Python scripts through Windows Scheduler. Sometimes, you need to call an<\/p>\n","protected":false},"author":1,"featured_media":4755,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[33,104],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Schedule Python Script Using Windows Scheduler - SS Blog<\/title>\n<meta name=\"description\" content=\"In this tutorial, you will learn how to schedule Python scripts through Windows Scheduler. Sometimes, you need to call an API.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/studysection.com\/blog\/schedule-python-script-using-windows-scheduler\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Schedule Python Script Using Windows Scheduler - SS Blog\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, you will learn how to schedule Python scripts through Windows Scheduler. Sometimes, you need to call an API.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/studysection.com\/blog\/schedule-python-script-using-windows-scheduler\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog Posts on famous people, innovations and educational topics\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/studysection\" \/>\n<meta property=\"article:published_time\" content=\"2021-08-04T04:31:47+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-04T04:58:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/08\/Python1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"300\" \/>\n\t<meta property=\"og:image:height\" content=\"200\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"admin-studysection-blog\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@studysection\" \/>\n<meta name=\"twitter:site\" content=\"@studysection\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin-studysection-blog\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/studysection.com\/blog\/schedule-python-script-using-windows-scheduler\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/studysection.com\/blog\/schedule-python-script-using-windows-scheduler\/\"},\"author\":{\"name\":\"admin-studysection-blog\",\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/person\/db367e2c29a12d1808fb1979edb3d402\"},\"headline\":\"Schedule Python Script Using Windows Scheduler\",\"datePublished\":\"2021-08-04T04:31:47+00:00\",\"dateModified\":\"2021-08-04T04:58:24+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/studysection.com\/blog\/schedule-python-script-using-windows-scheduler\/\"},\"wordCount\":409,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/studysection.com\/blog\/#organization\"},\"keywords\":[\"Python\",\"windows\"],\"articleSection\":[\"Learn and Grow\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/studysection.com\/blog\/schedule-python-script-using-windows-scheduler\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/studysection.com\/blog\/schedule-python-script-using-windows-scheduler\/\",\"url\":\"https:\/\/studysection.com\/blog\/schedule-python-script-using-windows-scheduler\/\",\"name\":\"Schedule Python Script Using Windows Scheduler - SS Blog\",\"isPartOf\":{\"@id\":\"https:\/\/studysection.com\/blog\/#website\"},\"datePublished\":\"2021-08-04T04:31:47+00:00\",\"dateModified\":\"2021-08-04T04:58:24+00:00\",\"description\":\"In this tutorial, you will learn how to schedule Python scripts through Windows Scheduler. Sometimes, you need to call an API.\",\"breadcrumb\":{\"@id\":\"https:\/\/studysection.com\/blog\/schedule-python-script-using-windows-scheduler\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/studysection.com\/blog\/schedule-python-script-using-windows-scheduler\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/studysection.com\/blog\/schedule-python-script-using-windows-scheduler\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/studysection.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Schedule Python Script Using Windows Scheduler\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/studysection.com\/blog\/#website\",\"url\":\"https:\/\/studysection.com\/blog\/\",\"name\":\"Blog Posts on famous people, innovations and educational topics\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/studysection.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/studysection.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/studysection.com\/blog\/#organization\",\"name\":\"StudySection\",\"url\":\"https:\/\/studysection.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/10\/studySection-logo.png\",\"contentUrl\":\"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/10\/studySection-logo.png\",\"width\":920,\"height\":440,\"caption\":\"StudySection\"},\"image\":{\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/studysection\",\"https:\/\/twitter.com\/studysection\",\"https:\/\/www.instagram.com\/study.section\/\",\"https:\/\/www.linkedin.com\/company\/studysection\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/person\/db367e2c29a12d1808fb1979edb3d402\",\"name\":\"admin-studysection-blog\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/studysection.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/054ac87a6874df1932004239cd8eab36?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/054ac87a6874df1932004239cd8eab36?s=96&d=mm&r=g\",\"caption\":\"admin-studysection-blog\"},\"url\":\"https:\/\/studysection.com\/blog\/author\/admin-studysection-blog\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Schedule Python Script Using Windows Scheduler - SS Blog","description":"In this tutorial, you will learn how to schedule Python scripts through Windows Scheduler. Sometimes, you need to call an API.","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:\/\/studysection.com\/blog\/schedule-python-script-using-windows-scheduler\/","og_locale":"en_US","og_type":"article","og_title":"Schedule Python Script Using Windows Scheduler - SS Blog","og_description":"In this tutorial, you will learn how to schedule Python scripts through Windows Scheduler. Sometimes, you need to call an API.","og_url":"https:\/\/studysection.com\/blog\/schedule-python-script-using-windows-scheduler\/","og_site_name":"Blog Posts on famous people, innovations and educational topics","article_publisher":"https:\/\/www.facebook.com\/studysection","article_published_time":"2021-08-04T04:31:47+00:00","article_modified_time":"2021-08-04T04:58:24+00:00","og_image":[{"width":300,"height":200,"url":"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/08\/Python1.png","type":"image\/png"}],"author":"admin-studysection-blog","twitter_card":"summary_large_image","twitter_creator":"@studysection","twitter_site":"@studysection","twitter_misc":{"Written by":"admin-studysection-blog","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/studysection.com\/blog\/schedule-python-script-using-windows-scheduler\/#article","isPartOf":{"@id":"https:\/\/studysection.com\/blog\/schedule-python-script-using-windows-scheduler\/"},"author":{"name":"admin-studysection-blog","@id":"https:\/\/studysection.com\/blog\/#\/schema\/person\/db367e2c29a12d1808fb1979edb3d402"},"headline":"Schedule Python Script Using Windows Scheduler","datePublished":"2021-08-04T04:31:47+00:00","dateModified":"2021-08-04T04:58:24+00:00","mainEntityOfPage":{"@id":"https:\/\/studysection.com\/blog\/schedule-python-script-using-windows-scheduler\/"},"wordCount":409,"commentCount":0,"publisher":{"@id":"https:\/\/studysection.com\/blog\/#organization"},"keywords":["Python","windows"],"articleSection":["Learn and Grow"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/studysection.com\/blog\/schedule-python-script-using-windows-scheduler\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/studysection.com\/blog\/schedule-python-script-using-windows-scheduler\/","url":"https:\/\/studysection.com\/blog\/schedule-python-script-using-windows-scheduler\/","name":"Schedule Python Script Using Windows Scheduler - SS Blog","isPartOf":{"@id":"https:\/\/studysection.com\/blog\/#website"},"datePublished":"2021-08-04T04:31:47+00:00","dateModified":"2021-08-04T04:58:24+00:00","description":"In this tutorial, you will learn how to schedule Python scripts through Windows Scheduler. Sometimes, you need to call an API.","breadcrumb":{"@id":"https:\/\/studysection.com\/blog\/schedule-python-script-using-windows-scheduler\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/studysection.com\/blog\/schedule-python-script-using-windows-scheduler\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/studysection.com\/blog\/schedule-python-script-using-windows-scheduler\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/studysection.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Schedule Python Script Using Windows Scheduler"}]},{"@type":"WebSite","@id":"https:\/\/studysection.com\/blog\/#website","url":"https:\/\/studysection.com\/blog\/","name":"Blog Posts on famous people, innovations and educational topics","description":"","publisher":{"@id":"https:\/\/studysection.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/studysection.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/studysection.com\/blog\/#organization","name":"StudySection","url":"https:\/\/studysection.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/studysection.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/10\/studySection-logo.png","contentUrl":"https:\/\/studysection.com\/blog\/wp-content\/uploads\/2021\/10\/studySection-logo.png","width":920,"height":440,"caption":"StudySection"},"image":{"@id":"https:\/\/studysection.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/studysection","https:\/\/twitter.com\/studysection","https:\/\/www.instagram.com\/study.section\/","https:\/\/www.linkedin.com\/company\/studysection"]},{"@type":"Person","@id":"https:\/\/studysection.com\/blog\/#\/schema\/person\/db367e2c29a12d1808fb1979edb3d402","name":"admin-studysection-blog","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/studysection.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/054ac87a6874df1932004239cd8eab36?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/054ac87a6874df1932004239cd8eab36?s=96&d=mm&r=g","caption":"admin-studysection-blog"},"url":"https:\/\/studysection.com\/blog\/author\/admin-studysection-blog\/"}]}},"views":805,"_links":{"self":[{"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/posts\/4754"}],"collection":[{"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/comments?post=4754"}],"version-history":[{"count":5,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/posts\/4754\/revisions"}],"predecessor-version":[{"id":4771,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/posts\/4754\/revisions\/4771"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/media\/4755"}],"wp:attachment":[{"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/media?parent=4754"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/categories?post=4754"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/studysection.com\/blog\/wp-json\/wp\/v2\/tags?post=4754"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}