In Windows 10
, it is a story to add ʻAnaconda PowerShell Prompt to
Windows Terminal. I wrote this article because I found only the ones that can add ʻAnaconda Prompt
by searching.
For those who use [ʻAnaconda](https://docs.conda.io/projects/conda/en/latest/glossary.html#anaconda), [
Miniconda](https://docs.conda) Those who use .io / projects / conda / en / latest / glossary.html # miniconda) should also be using ʻAnaconda Prompt
.
Anyone who has been with Conda
for a long time will want to use it in the latest environment.
[ʻAnaconda Promptnow supports
Powershell](https://qiita.com/yniji/items/668f805a72a6ced6a2bd), but it was still not perfect. This is because each time Powershell is started, the environment variable
% PATH% for the
condacommand is set and the
(base) virtual environment is ʻactivate
, which is a pain of waiting time.
However, nowadays, immediately after installing ʻAnaconda or
Miniconda, shortcuts are prepared in advance for ʻAnaconda PowerShell Prompt
and ʻAnaconda Prompt`, which is very convenient.
Under these circumstances, Windows Terminal
has appeared.
It's great that you can use different types of terminals as tabs in a single window.
What's more, the startup time of PowerShell
is shortened and it is stress-free.
You have no choice but to add ʻAnaconda Powershell Prompt`. So what should I do?
First of all, the configuration file is like PowerShell
,
$env:LocalAppData\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json
It is placed in. In the Cmd
style,
%LocalAppData%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json
It is placed in.
And add the following to this json
file.
{
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44b9}",
"name": "Anaconda Prompt",
"startingDirectory" : "%HOMEPATH%",
"commandline": "%userprofile%\\Documents\\PowerShell\\conda.cmd",
"icon": "%SystemDrive%\\tools\\miniconda3\\Menu\\Iconleak-Atrous-PSConsole.ico",
"hidden": false
}
Use New-GUID
forguid
It seems that the value created by However, it is troublesome, so I just copied and pasted the Powershell
one and changed one character.
I think name
can be anything as long as you know yourself.
You can use whatever you like for ʻicon`, but I linked to the official icon.
commandline
specifies to execute the following batch file.
%userprofile%\\Documents\\PowerShell\\conda.cmd
%windir%\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy ByPass -NoExit -Command "& 'C:\tools\miniconda3\shell\condabin\conda-hook.ps1' ; conda activate 'C:\tools\miniconda3' "
The contents of this batch file are just a copy-paste of the link destination string for PowerShell from the shortcut files in C: \ ProgramData \ Microsoft \ Windows \ Start Menu \ Programs \ Anaconda3 (64-bit)
. ..
Looking at stackoverflow etc., " commandline
is from the shortcut file of the start menu
There are many things that say "copy and paste the link destination character string". But this doesn't work.
The properties of the shortcut file in C: \ ProgramData \ Microsoft \ Windows \ Start Menu \ Programs \ Anaconda3 (64-bit)
are as follows, but even if you copy and paste this and specify it in commandline
, the command is normal. Because it will not be received as.
The part after -Command
just got an error and it didn't work. That said, because how to receive Powershell arguments is too mysterious It may just not be understandable to me. Is there any way?
It was a waste of time, so I decided to write this string to a batch file and have it run.
And finally, in my case, the settings were as follows.
json-doc:%LocalAppData%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
"profiles":
{
"defaults":
{
// Put settings here that you want to apply to all profiles
"fontFace": "Cascadia Code PL",
"useAcrylic": true,
"acrylicOpacity": 0.7
},
"list":
[
{
// Make changes here to the powershell.exe profile
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "Windows PowerShell",
"commandline": "powershell.exe",
"hidden": false
},
{
// Make changes here to the cmd.exe profile
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"name": "cmd",
"commandline": "cmd.exe",
"hidden": false
},
{
//"guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
//"hidden": false,
//"name": "PowerShell",
//"source": "Windows.Terminal.PowershellCore"
"guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
"name": "PowerShell Core",
"source": "Windows.Terminal.PowershellCore",
"hidden": false
},
{
"guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
"hidden": false,
"name": "Azure Cloud Shell",
"source": "Windows.Terminal.Azure"
},
{
"guid": "{46ca431a-3a87-5fb3-83cd-11ececc031d2}",
"hidden": false,
"name": "kali-linux",
"source": "Windows.Terminal.Wsl"
},
{
"guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
"hidden": false,
"name": "Ubuntu",
"source": "Windows.Terminal.Wsl"
},
{
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44b9}",
"name": "Anaconda Prompt",
"startingDirectory" : "%HOMEPATH%",
"commandline": "%userprofile%\\Documents\\PowerShell\\conda.cmd",
"icon": "%SystemDrive%\\tools\\miniconda3\\Menu\\Iconleak-Atrous-PSConsole.ico",
"hidden": false
}
]
},
// Add custom color schemes to this array
"schemes": [],
// Add any keybinding overrides to this array.
// To unbind a default keybinding, set the command to "unbound"
"keybindings": []
}
The following is the state after the settings are reflected. What do you think.
If you want to know more about the settings, please see Editing Windows Terminal JSON Settings. please look.
The environment in this article is as follows.
In my case, I use Chocolatey
to install Miniconda3
and Windows Terminal
.
Even if you download it directly from the official website, you can go in almost the same way.
Excelsior!
Recommended Posts