Skip to content

Instantly share code, notes, and snippets.

@jgbishop

jgbishop/work.bat

Created Feb 11, 2020
Embed
What would you like to do?
Helper script to enable or disable a Python virtual environment
@echo off
if exist "%cd%\venv" (
if "%1" == "off" (
echo Deactivating virtual environment
call "%cd%\venv\Scripts\deactivate.bat"
echo.
) else (
echo Activating virtual environment
call "%cd%\venv\Scripts\activate.bat"
)
) else (
echo No venv folder found in %cd%.
)
@jgbishop

This comment has been minimized.

Copy link
Owner Author

@jgbishop jgbishop commented Feb 11, 2020

This script makes it easy to enable or disable a virtual environment from a Windows shell (just make sure the script is somewhere in your PATH). A simple work command will enable the virtual environment, while work off will disable the virtual environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.