As the title suggests, I would like to run Anaconda
's ipython
on Windows 10's Windows Terminal (Preview)
(preferrably in the cmd.exe
tab) in one go.
By in one go I mean, with a single shortcut or batch file, I can start to work with ipython
environment in Windows 10's Windows Terminal (perview)
.
Currently I can do it in 3 steps:
Open
Windows Terminal (Preview)
. Alternatively, I can create a shortcut to the program, whose path isC:\Program Files\WindowsApps\Microsoft.WindowsTerminal_0.5.2661.0_x64__8wekyb3d8bbwe\WindowsTerminal.exe
. I have changed the preference so that the default tab iscmd.exe
instead ofPowerShell
.Within
Windows Terminal (Preview)
, start Anaconda's environment by enteringC:\Anaconda3\Scripts\activate.bat C:\Anaconda3
, whereC:\Anaconda3
is my installation folder. Then each line of the prompt will start with(base)
.Enter
ipython
in the prompt. Ipython will then start. The prompt now becomes likeIn [1]:
.
But I do not know how to combine the above 3 steps into one, with a batch file or anything. Any idea that helps the automation is much appreciated!
Edit: For your reference, the content of C:\Anaconda3\Scripts\activate.bat
is
@REM Copyright (C) 2012 Anaconda, Inc
@REM SPDX-License-Identifier: BSD-3-Clause
@REM Test first character and last character of %1 to see if first character is a "
@REM but the last character isn't.
@REM This was a bug as described in https://github.com/ContinuumIO/menuinst/issues/60
@REM When Anaconda Prompt has the form
@REM %windir%\system32\cmd.exe "/K" "C:\Users\builder\Miniconda3\Scripts\activate.bat" "C:\Users\builder\Miniconda3"
@REM Rather than the correct
@REM %windir%\system32\cmd.exe /K ""C:\Users\builder\Miniconda3\Scripts\activate.bat" "C:\Users\builder\Miniconda3""
@REM this solution taken from https://stackoverflow.com/a/31359867
@set "_args1=%1"
@set _args1_first=%_args1:~0,1%
@set _args1_last=%_args1:~-1%
@set _args1_first=%_args1_first:"=+%
@set _args1_last=%_args1_last:"=+%
@set _args1=
@if "%_args1_first%"=="+" if NOT "%_args1_last%"=="+" (
@CALL "%~dp0..\condabin\conda.bat" activate
@GOTO :End
)
@REM This may work if there are spaces in anything in %*
@CALL "%~dp0..\condabin\conda.bat" activate %*
:End
@set _args1_first=
@set _args1_last=