Created
April 19, 2026 00:33
-
-
Save bskinn/a7d2062015307323d9b0b7012f4423d5 to your computer and use it in GitHub Desktop.
Windows cmd BAT helper script for activating Python venvs
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 Put somewhere on PATH. | |
| REM I usually add %USERPROFILE%/bin/ to PATH and | |
| REM put this script in there. | |
| REM | |
| REM No suffix, looks for env, .env, venv, and .venv | |
| REM | |
| REM > vact | |
| REM | |
| REM Same, but looks for envSUFFIX, etc. | |
| REM | |
| REM > vact SUFFIX | |
| REM | |
| @echo off | |
| if exist "env%~1\" ( | |
| env%1\Scripts\activate.bat | |
| ) | |
| if exist ".env%~1\" ( | |
| .env%1\Scripts\activate.bat | |
| ) | |
| if exist "venv%~1\" ( | |
| venv%1\Scripts\activate.bat | |
| ) | |
| if exist ".venv%~1\" ( | |
| .venv%1\Scripts\activate.bat | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment