• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1@echo off
2
3rem This file is UTF-8 encoded, so we need to update the current code page while executing it
4for /f "tokens=2 delims=:" %%a in ('"%SystemRoot%\System32\chcp.com"') do (
5    set "_OLD_CODEPAGE=%%a"
6)
7if defined _OLD_CODEPAGE (
8    "%SystemRoot%\System32\chcp.com" 65001 > nul
9)
10
11set "VIRTUAL_ENV=__VENV_DIR__"
12
13if not defined PROMPT (
14    set "PROMPT=$P$G"
15)
16
17if defined _OLD_VIRTUAL_PROMPT (
18    set "PROMPT=%_OLD_VIRTUAL_PROMPT%"
19)
20
21if defined _OLD_VIRTUAL_PYTHONHOME (
22    set "PYTHONHOME=%_OLD_VIRTUAL_PYTHONHOME%"
23)
24
25set "_OLD_VIRTUAL_PROMPT=%PROMPT%"
26set "PROMPT=__VENV_PROMPT__%PROMPT%"
27
28if defined PYTHONHOME (
29    set "_OLD_VIRTUAL_PYTHONHOME=%PYTHONHOME%"
30    set PYTHONHOME=
31)
32
33if defined _OLD_VIRTUAL_PATH (
34    set "PATH=%_OLD_VIRTUAL_PATH%"
35) else (
36    set "_OLD_VIRTUAL_PATH=%PATH%"
37)
38
39set "PATH=%VIRTUAL_ENV%\__VENV_BIN_NAME__;%PATH%"
40
41:END
42if defined _OLD_CODEPAGE (
43    "%SystemRoot%\System32\chcp.com" %_OLD_CODEPAGE% > nul
44    set "_OLD_CODEPAGE="
45)
46