Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a BAT file for python script

How can I create a simple BAT file that will run my python script located at C:\somescript.py?

like image 837
Josh Avatar asked Dec 31 '10 16:12

Josh


People also ask

How do I create a .bat file?

To create a Windows batch file, follow these steps: Open a text file, such as a Notepad or WordPad document. Add your commands, starting with @echo [off], followed by, each in a new line, title [title of your batch script], echo [first line], and pause. Save your file with the file extension BAT, for example, test.

Can you run a batch file in Python?

You can also run a batch file in Python with arguments passed on the Python script. The general syntax for passing arguments using the two packages, os and subprocess, is shown below: os: import os os.


1 Answers

c:\python27\python.exe c:\somescript.py %* 
like image 113
MK. Avatar answered Sep 30 '22 11:09

MK.