Created
January 19, 2021 16:53
-
-
Save bskinn/eb4a30aaac418b63e602ad3dba4c727c to your computer and use it in GitHub Desktop.
Windows batch file for quick virtualenv creation
This file contains 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
@echo off | |
for /f "tokens=*" %%C in ( 'python3.9 -c "import os, re; print(re.search(r'[^\\]+$', os.getcwd(), re.M).group(0))"' ) do ( | |
set DIRNAME=%%C | |
) | |
if [%2]==[] ( | |
python%1 -m virtualenv env --prompt="(%DIRNAME%) " | |
) else ( | |
python%1 -m virtualenv env --prompt="(%2) " | |
) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Variation of this.
cmd IF syntax here.
Would be better to use
pathlib
, but that's less concise for a one-liner.