How to Create a Batch File to Run a Python Script
In this tutorial, you will create a batch file that runs a Python script when opened.
TLDR solution
script.bat
"path-to-python\python.exe" "path-to-script\script.py"
pause
Step-by-Step Example
Step 1: Locate your Python
To find the path of your Python, search python, right click on the relevant search result and click Open file location:

In the Windows Explorer right click on the Python icon and click on Properties:

Copy the target path:

Here is an example of a Python application path:
C:\Users\DataToFish\AppData\Local\Programs\Python\Python39\python.exe
Step 2: Locate your Python Script
Let's we have a Python script located inside folder named Test on your desktop.
It's path looks something like this:
C:\Users\DataToFish\Desktop\Test\script.py
Step 3: Create the Batch File
Now that you have both paths, open your Notepad App and create the batch file:
script.bat
"C:\Users\...\Python39\python.exe" "C:\Users\...\Desktop\Test\script.py"
pause
Don't forget to use your paths and save the file with a .bat extension, e.g., script.bat.
That's it! You just created a batch file that runs a Python script when opened.