Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • Python Tutorial
  • Interview Questions
  • Python Quiz
  • Python Glossary
  • Python Projects
  • Practice Python
  • Data Science With Python
  • Python Web Dev
  • DSA with Python
  • Python OOPs
Open In App
Next Article:
How to Run a Python Script
Next article icon

Schedule a Python Script to Run Daily

Last Updated : 07 Apr, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

In this article, we are going to see how to schedule a Python Script to run daily. Scheduling a Python Script to run daily basically means that your Python Script should be executed automatically daily at a time you specify.

Step-by-Step Implementation

Create a Python file, for example: gmail_automation.py, and write your script inside it. Make sure everything works as expected when you run it manually, this is the script that will be scheduled to run automatically

Alternatively, you may use any Python script that you’d like to schedule.

Python
import webbrowser  # Gmail URL url = "https://mail.google.com"  # Path to your Chrome browser chrome_path = r"C:\Program Files\Google\Chrome\Application\chrome.exe"  # Register and open Chrome browser with Gmail webbrowser.register('chrome', None, webbrowser.BackgroundBrowser(chrome_path)) webbrowser.get('chrome').open_new_tab(url) 

Note: Change your chrome_path according to the location on your system if you want to use the above Python Script.

Now there are two ways to schedule a script:

  • Using batch files.
  • Using Windows Task Scheduler.

Method 1: Using batch file

Step 1: Create a Batch File.

Open Notepad and add the following (update the paths):

"Path where your Python exe is stored\python.exe" "Path where your Python script is stored\script name.py"

pause

Example of the batch file:

Step 2: Save the File

Save it with a .bat extension, e.g. open_gmail.bat.

To check if the scripts is working or not, navigate to the .bat file and open it (or double click on it) and it should launch the gmail in chrome browser.

Method 2: Using Windows Task Scheduler.

Step 1: Open Task Scheduler by navigating to:

Start Menu > Administrative Tools > Task Scheduler

Or search Task Scheduler in the Start menu.

Step 2: Create a New Basic Task

  • Click "Create Basic Task..."
  • Give your task a name (e.g. "Open Gmail Daily") and a description.
  • Click Next.

Step 3: Set the Trigger

  • Choose "Daily"
  • Set the start time when you want the script to run.
  • Click Next.

Step 4: Select the "Start a Program" option and click Next.

If you created a batch file earlier, enter its full path in the Program/script field (e.g., C:\path\to\yourbatchfilename.bat), then click Next and Finish. Your Python script will now run daily at the scheduled time.
In this section, you'll need the file location of the following files:

  • python.exe - The path where python.exe is stored.
  • the path where your python script file is stored.

You can simply get both the paths by running command- "where python" in the command prompt and copy the paths form there.

In our case : 

Path of python.exe  -  C:\Python39\python.exe

Path of my python script  -  D:\Tutorials\Python

Step 5: Add respective file locations as shown in the figure below and arguments input, specify your python script name.

Step 6: In the next tab, you just need to verify your Inputs and then click on 'Finish'.

That's it, your Python Script is now Scheduled and will be executed daily at your Specified time. Here is the Screenshot of our Python Script that got executed.


Next Article
How to Run a Python Script
author
vaibhavpatel1904
Improve
Article Tags :
  • Python
  • python-utility
Practice Tags :
  • python

Similar Reads

  • How to Run a Python Script
    Python scripts are Python code files saved with a .py extension. You can run these files on any device if it has Python installed on it. They are very versatile programs and can perform a variety of tasks like data analysis, web development, etc. You might get these Python scripts if you are a begin
    6 min read
  • Scheduling Python Scripts on Linux
    Sometimes we need to do a task every day, and we can do these repetitive tasks every day by ourselves, or we can use the art of programming to automate these repetitive tasks by scheduling the task. And today in this article we are going to learn how to schedule a python script on Linux to do the re
    3 min read
  • Schedule Python Script using Windows Scheduler
    In this article, we are going to schedule a python script using a windows task scheduler, i.e. make it launch automatically at a certain time or after a certain time period. Before starting we need to know the following point: Python Script: It is a bunch of python code meant to be directly executed
    4 min read
  • How to Schedule an Email in Gmail
    In today's digital age, email is an indispensable tool for both personal and professional communication. While we often send emails immediately, there are times when scheduling an email to be sent later is more beneficial. Scheduling emails in Gmail ensures timely delivery, even when you're unavaila
    6 min read
  • How to Run a Python Script using Docker?
    Docker helps you to run your Python application very smoothly in different environments without worrying about underlying platforms. Once you build an image using dockerfile you can run that image wherever you want to run. Docker image will help you to package all the dependencies required for the a
    8 min read
  • How to run Scrapy spiders in Python
    In this article, we are going to discuss how to schedule Scrapy crawl execution programmatically using Python. Scrapy is a powerful web scraping framework, and it's often necessary to schedule the execution of a Scrapy crawl at specific intervals. Scheduling Scrapy crawl execution programmatically a
    5 min read
  • How to Run Python Script in GitHub Actions ?
    A tool available on GitHub that can help you automate chores in your software projects is called GitHub Actions. It enables you to design workflows that, when executed automatically, carry out actions like as deploying, testing, and even sending out notifications. It basically works like a small rob
    6 min read
  • Python | Schedule Library
    Schedule is in-process scheduler for periodic jobs that use the builder pattern for configuration. Schedule lets you run Python functions (or any other callable) periodically at pre-determined intervals using a simple, human-friendly syntax.Schedule Library is used to schedule a task at a particular
    3 min read
  • How to setup Notepad to run Python Script
    Due to its simplicity, versatility, and readability, Python has become phenomenally popular as a computer language that is highly leveled and dynamically typed. These are some of the IDEs for Python development that have many tools; however, if you are just starting or want it lighter, then Windows’
    2 min read
  • How to Create AWS Instance Scheduler ?
    Sometimes the AWS EC2 instances are created unnecessarily, causing an unwanted bill where the resources were not used and we still have to pay for them. In such scenarios, an instance scheduler comes in handy, to avoid the hassle of redundant and extra instances and to help save money. In this artic
    5 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences