Skip to content

Instantly share code, notes, and snippets.

@KnightChaser
Created October 15, 2021 06:58
Show Gist options
  • Save KnightChaser/3973af54dce7880e83bba2376449e035 to your computer and use it in GitHub Desktop.
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!
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.")
@KnightChaser
Copy link
Author

I know this code is totally useless fucking shit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment