Last active
September 2, 2024 16:24
-
-
Save nmpowell/d444820b58f10568b15a082ee4f591cf to your computer and use it in GitHub Desktop.
Windows batch script to run a Python program or script within its virtual environment. This can be called from Windows Task Scheduler.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REM Windows batch script to run 1+ Python program/scripts, sequentially, within their virtual environment. This can be called from Windows Task Scheduler. | |
set original_dir=%CD% | |
set venv_root_dir="C:\Python-Venvs\env-name" | |
cd %venv_root_dir% | |
call %venv_root_dir%\Scripts\activate.bat | |
python your_python_script.py <arg1> <arg2> <arg3> | |
installed_python_cli_program <arg1> <arg2> <arg3> | |
call %venv_root_dir%\Scripts\deactivate.bat | |
cd %original_dir% | |
exit /B 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Amazing, thanks! This also works from cmd so u can create a shortcut to run on demand etc