Skip to content

Instantly share code, notes, and snippets.

@caglartoklu
Last active April 6, 2020 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caglartoklu/2c963d347270510bf3da0f0a6d11087e to your computer and use it in GitHub Desktop.
Save caglartoklu/2c963d347270510bf3da0f0a6d11087e to your computer and use it in GitHub Desktop.
Makes it easier to switch to Python virtual environments.
@ECHO OFF
REM Introduction to workonw.bat
REM Makes it easier to switch to Python virtual environments.
REM Another purpose is simplicity.
REM This is Windows only.
REM
REM This is a simple alternative to feature packed virtualenvwrapper:
REM https://virtualenvwrapper.readthedocs.io/en/latest/command_ref.html
REM
REM Installation:
REM Copy this file to a directory in PATH,
REM or a short named directory such as C:\bin
REM
REM Configuration:
REM Find "CONFIG1" without quotes in this file and
REM adjust the following line accordingly:
REM cd path\to\virtual_envs_on_your_system
REM
REM Usage:
REM list the virtual environments:
REM workonw
REM switch to a virtual environment:
REM workonw myenv
REM CONFIG1: Replace this folder with the actual path on you system.
cd path\to\virtual_envs_on_your_system
IF [%1]==[] GOTO NO_ARGUMENT
:ACTIVATE
REM there is one argument, activate it.
cd %1
cd Scripts
activate.bat
goto FINISH
:NO_ARGUMENT
REM no argument is provided, list the virtual environments.
dir
:FINISH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment