Created
October 15, 2021 06:58
-
-
Save KnightChaser/3973af54dce7880e83bba2376449e035 to your computer and use it in GitHub Desktop.
Create bunch of python virtual environment(venv) with just a click. Have fun!
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
import os | |
startNumber = 101 | |
EndNumber = 500 | |
for _seq in range(startNumber, EndNumber + 1): | |
# Just name | |
name = f"flaskvenv{_seq}" | |
# basic command | |
os.system("cd C:\\venvs") | |
os.system(f"python -m venv {name}") | |
os.system(f"mkdir C:\\projects\\{name}") | |
print(f"[alert] venv {_seq} base is almost achieved.") | |
# create file and write down payload | |
scriptPayload = f"""@echo off | |
@cd C:\\projects\\{name} | |
@C:\\venvs\\{name}\\Scripts\\activate | |
""" | |
filename = f"C:\\venvs\\{name}.cmd" | |
scriptBatchFile = open(filename, 'w') | |
scriptBatchFile.write(scriptPayload) | |
scriptBatchFile.close() | |
print(f"[alert] venv {_seq} finished.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I know this code is totally useless fucking shit.