Skip to content

Instantly share code, notes, and snippets.

@bskinn
Created April 19, 2026 00:33
Show Gist options
  • Select an option

  • Save bskinn/a7d2062015307323d9b0b7012f4423d5 to your computer and use it in GitHub Desktop.

Select an option

Save bskinn/a7d2062015307323d9b0b7012f4423d5 to your computer and use it in GitHub Desktop.
Windows cmd BAT helper script for activating Python venvs
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