Skip to content

How To Create a *.bat File in Windows For Task Scheduler To Run Python Script

  • by

If you would like to run your Python script without having to open your IDE to complete a task, you can do so by creating a *.bat file. I’d be interested to hear what other reasons why you found this page to create your *.bat file in the comments below, because I’m sure there are some pretty cool tasks out there you are doing.

The format of the *.bat file is as:

“<location to python.exe file>” “<location of your python.py script you want to run>”

For me, this looked like:

“C:\Python\Python39\python.exe” “C:\Python\Python39\programs\coolProgram.py”

Saving the File

Saving the file is the tricky part.

Make sure you have the drop down save as type selected to *.*. If you don’t your file will save as filename.bat.txt.

To avoid any file location issues, I’d suggest saving this *.bat file in the same location you have your python script in.

Leave a Reply

Your email address will not be published. Required fields are marked *

15 + nineteen =