How can I create a simple BAT file that will run my python script located at C:\somescript.py?
Open a command line (⊞ Win+R, cmd
, ↵ Enter)
and type python -V
, ↵ Enter.
You should get a response back, something like Python 2.7.1
.
If you do not, you may not have Python installed. Fix this first.
Once you have Python, your batch file should look like
@echo off
python c:\somescript.py %*
pause
This will keep the command window open after the script finishes, so you can see any errors or messages. Once you are happy with it you can remove the 'pause' line and the command window will close automatically when finished.