[ Home ] [ Tech Tips ] [ Raspberry Pi] [ Powershell ] [ Ubuntu ] [ Django ] [ About ]
Python | Start Python Script via Run.bat

Python | Start Python Script via Run.bat 

Easy one today where we are making a .bat file to run a script. 

This assumes your file is called main.py and that your virtual python environment is in venv\Scripts\python.exe so adjust accordingly

 

SET ThisScriptsDirectory=%~dp0
SET PyScriptPath="%ThisScriptsDirectory%main.py"
%ThisScriptsDirectory%venv\Scripts\python.exe %PyScriptPath%
pause

 

Most up to date version of this file is at 

https://github.com/LukeKeam/python-start-script-bat

 

Luke Keam
Thank you for reading. Any questions, comments or suggestions email me [email protected]
Have a great day

Luke Keam
techgeek.biz

AD

techgeek logo.biz

AD