Schedule a Python Script to Run Daily
Last Updated : 07 Apr, 2025
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.
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