I just installed PowerShell 7, and since I had anaconda installed before, this seems to add the starting command to the profile.ps1
automatically.
The profile.ps1
in C:\Users\USER\Documents\PowerShell
(this is version 7, directory WindowsPowerShell
would be the old version 5) contains:
#region conda initialize
# !! Contents within this block are managed by 'conda init' !!
(& "C:\Users\USER\anaconda3\Scripts\conda.exe" "shell.powershell" "hook") | Out-String | Invoke-Expression
#endregion

With these automatic settings at the start of PowerShell 7, adding PowerShell 7 as a new terminal type to vsccode solved it.
This is how to add PowerShell 7 to the dropdown menu:
Enter Ctrl+Shift+P
, open settings.json
for the User, and add
{
"terminal.integrated.profiles.windows": {
"PowerShell7": {
"path": "C:\\Program Files\\PowerShell\\7\\pwsh.exe",
"args": ["-NoProfile",
"-noexit",
"-file",
"C:\\Users\\USER\\Documents\\PowerShell\\profile.ps1"]
}
},
"terminal.integrated.defaultProfile.windows": "PowerShell7"
}
Then in the settings.json
, press Ctrl+s
and restart (!) vscode. You will see PowerShell7 as the new default terminal in the dropdown of terminal types:
