-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstart_conda.bat
55 lines (52 loc) · 2.37 KB
/
start_conda.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
@ECHO OFF
setlocal EnableDelayedExpansion
rem ---------------------
rem Configure these paths
set target_path="C:\Users\%USERNAME%\Miniconda3\Scripts\activate.bat"
set starting_conda_env=C:\Users\%USERNAME%\Miniconda3
if exist "C:\Users\%USERNAME%\miniconda3\" (
set target_path="C:\Users\%USERNAME%\miniconda3\Scripts\activate.bat"
set starting_conda_env=C:\Users\%USERNAME%\miniconda3
) else if exist "C:\Users\%USERNAME%\miniforge3\" (
set target_path="C:\Users\%USERNAME%\miniforge3\Scripts\activate.bat"
set starting_conda_env=C:\Users\%USERNAME%\miniforge3
) else if exist "C:\ProgramData\Miniconda3\" (
set target_path="C:\ProgramData\Miniconda3\Scripts\activate.bat"
set starting_conda_env=C:\ProgramData\Miniconda3
) else if exist "C:\ProgramData\miniconda3\" (
set target_path="C:\ProgramData\miniconda3\Scripts\activate.bat"
set starting_conda_env=C:\ProgramData\miniconda3
) else if exist "C:\ProgramData\miniforge3\" (
set target_path="C:\ProgramData\miniforge3\Scripts\activate.bat"
set starting_conda_env=C:\ProgramData\miniforge3
) else if exist "C:\Users\%USERNAME%\AppData\Local\Miniconda3\" (
set target_path="C:\Users\%USERNAME%\AppData\Local\Miniconda3\Scripts\activate.bat"
set starting_conda_env=C:\Users\%USERNAME%\AppData\Local\Miniconda3
) else if exist "C:\Users\%USERNAME%\AppData\Local\miniconda3\" (
set target_path="C:\Users\%USERNAME%\AppData\Local\miniconda3\Scripts\activate.bat"
set starting_conda_env=C:\Users\%USERNAME%\AppData\Local\miniconda3
) else if exist "C:\Users\%USERNAME%\AppData\Local\miniforge3" (
set target_path="C:\Users\%USERNAME%\AppData\Local\miniforge3\Scripts\activate.bat"
set starting_conda_env=C:\Users\%USERNAME%\AppData\Local\miniforge3
)
rem ---------------------
if "%~1" == "" (
set run_mode=shell
) else (
set run_mode=pyscript
)
if not exist %target_path% (
title ERROR
cmd /k "echo Target does not exist: %target_path%&echo.&echo Configure paths in this script: %0"
) else (
title Anaconda Prompt
if "%run_mode%" == "shell" (
cmd /k %target_path% %starting_conda_env%
) else if "%run_mode%" == "pyscript" (
if "%SHELL_UTILS_START_PYSCRIPT_KEEP_OPEN%" == "true" (
call %target_path% %starting_conda_env% & cmd /k "python %*"
) else (
call %target_path% %starting_conda_env% & cmd /c "python %*"
)
)
)