How to I remove the Powershell start text? - powershell

Powershell 6 has a Unix-style /etc/issue that mentions a link to the docs.
PowerShell v6.0.0
Copyright (c) Microsoft Corporation. All rights reserved.
https://aka.ms/pscore6-docs
Type 'help' to get help.
This is fine, but:
I know where the docs are
I know I launched Powershell 6
How can I remove some, or all of the message? IIRC Powershell 5 still had the copyright message so maybe I can't remove that, but getting rid of the last 3 lines would help?

Pass the -nologo option.
-NoLogo Starts the PowerShell console without displaying the copyright banner.
pwsh.exe -nologo ...other arguments...

If you are using the new Windows Terminal then:
Go to Settings:
Add the argument -nologo to the PowerShell command line:

From #sandu's answer, it could be improved as below.
"terminal.integrated.profiles.windows": {
"PowerShell": {
"source": "PowerShell",
"args": ["-noLogo"]
}
},
"terminal.integrated.defaultProfile.windows": "PowerShell",

Now you can add -nologo in Windows Terminal settings:

The easiest way would be to add Clear-Host to the top of your $profile file.

You can open powershell and input $profile, you will get Microsoft.PowerShell_profile.ps1 file's path.
open this file (create one without) by notepad and input a clear or cls command.Save and exit.
the command of this file will be executed when you open powershell

As np8 said under this answer, the way to hide the initial text in the Visual Studio Code integrated terminal is as follows:
Open the workspace settings file (./.vscode/settings.json) or the user settings file (search for Preferences: Open Settings (JSON) in the command palette, opened with F1)
Add the following inside the outer-most "layer" of curly brackets:
"terminal.integrated.shellArgs.windows": [
"-nologo"
]

What worked for me was to go to File > Preferences > Settings and type terminal.integrated.defaultProfile.windows in the search bar (you can change windows with other supported OS if you need to). There should now be only one option to choose from (that's why I included windows). Click on the Edit in settings.json link bellow it. It should now open settings.json and generate the line necessary to modify the default terminal profile. Which looks something like:
"terminal.integrated.defaultProfile.windows": "",
Above that line you can create your own profile:
"terminal.integrated.profiles.windows": {
"PowerShell -nologo": {
"source": "PowerShell",
"args": ["-nologo"]
}
},
Name the profile however you want and add whatever parameters you want. Once you're done. Set the profile name into the option that was previously generated for you. In this example it should look like:
"terminal.integrated.defaultProfile.windows": "PowerShell -nologo",
Save and close. Now when you open a terminal it should have no logo for example.

I was fix problem on the top by

There are several ways of doing it :
Creating a shortcut with value
"C:\Program Files\PowerShell\7\pwsh.exe" -nologo -NoExit -Command "Set-Location c:\Users\%username%"
If you are using Windows terminal then you can replace the source with
"commandline": "pwsh.exe -NoLogo"

Users of Chinese version can also add -nologo in Windows terminal settings:
As shown in the figure:

If you are using the new Windows Terminal in Windows 11,
Go to Settings:
Select the Windows Powershell profile from the left sidebar
Add the argument -nologo to the command line:
Save and be sure to restart your terminal to see the changes.

If you're using windows just create a profile and put the command clear inside it.
In PowerShell I'm going to open the profile with notepad:
notepad $Profile

Highly Recommended to Use
Powershell Preview: https://github.com/PowerShell/powershell/releases
Editing Context Menu
If you are using Powershell Preview, you can change context menu using regedit:
Open regedit
Go to Computer\HKEY_CLASSES_ROOT\Directory\Background\shell\PowerShell7-previewx64
add flag -nologo to Icon
2. Editing Start Menu Shortcut
In File Explorer go to
C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
Create a shortcut with value
"C:\Program Files\PowerShell\7-preview\pwsh.exe" -nologo -NoExit -Command "Set-Location c:\\Users\\%username%"

Related

Default Powershell Terminal is 7.2 but scripts run as Powershell 5.1

Notice in my VS Code, a fresh terminal, the very first line indicates it is properly defaulted to Powershell 7.2.2 - just as I believe it should.
But then in this same screenshot, the first script I run (which has a command to print out the powershell version) it shows the PSVersion is 5.1.19041.1320
Here's all my powershell specific VSCode entries from settings.json
"terminal.integrated.profiles.windows": {
"MyPowerShell_7": {
"path": "C:\\Program Files\\PowerShell\\7\\pwsh.exe",
"args": ["-NoProfile"]
}
},
"terminal.integrated.defaultProfile.windows": "MyPowerShell_7",
"powershell.powerShellAdditionalExePaths": [
{
"exePath": "C:\\Program Files\\PowerShell\\7\\pwsh.exe",
"versionName": "MyPowerShell_7"
}
],
"powershell.powerShellDefaultVersion": "MyPowerShell_7",
Why why why is it so hard to run the Test-Json cmdlet?
finally found an answer here on reddit
I didn't know that 5.1 and 7 are side-by-side and have different ways to invoke each application
So, if I change my command from powershell to pwsh I get the right result
Actually, when you have a PowerShell or pwsh terminal open (Which you have here) you should call your script directly and it will be executed in that host.
So instead of
PS C:\>pwsh -file './scripts/ps/experiment.ps1'`
you should call
PS C:\>./scripts/ps/experiment.ps1
The way you are calling your scripts will launch a new host, run the script and then terminate.

How can I start Powershell script as noprofile in Visual Studio Code

How can I start Powershell script as noprofile in Visual Studio Code, I can run the Powershell Ise with noprofile with command PowerShell_Ise -NoProfile . But howcan we do the same for a poershell session in Visual Studio Code.
If you're running PowerShell in the PIC (PowerShell Integrated Console), which is a a special shell that comes with the PowerShell extension:
To turn off profile loading in this special shell, make sure that the
PowerShell: Enable Profile Loading option for the PowerShell extension is unchecked (via File > Preferences > Settings, Ctrl-,).
See the bottom section for how to control which particular PowerShell edition / executable is used in the PIC (PowerShell Integrated Console).
If you're running PowerShell as a general-purpose shell in Visual Studio Code's integrated terminal:
You'll have to modify the default PowerShell shell profile or add a custom profile, with an "args" argument value of [ "-noprofile" ], by direct editing of the JSON file underlying the settings, settings.json (>Preferences: Open Settings (JSON) from the command palette).
The following shows a relevant settings.json excerpt with a modified default PowerShell profile that suppresses profile loading.
"terminal.integrated.profiles.windows": {
"PowerShell": {
"source": "PowerShell",
"icon": "terminal-powershell",
"args": [ "-noprofile" ] // suppress profile loading
}, // ...
}
Read on for detailed, general information about shells and terminals in Visual Studio Code.
Overview of shell and terminal settings in Visual Studio Code:
3 different types of shells apply intrinsically:
The default shell for the integrated terminal (the TERMINAL tab of the panel).
Optionally, the automation shell to use for automation tasks (defined in tasks.json) instead of the default integrated-terminal shell.
The default shell for opening an external terminal (> Open New External Terminal); note that on Windows you can specify a shell executable directly, but on Unix-like platforms you must specify a terminal application, which itself then determines the shell to launch - see details below.
With the PowerShell extension installed, yet another shell applies:
The specific PowerShell executable to use for the PIC (PowerShell Integrated Console), which provides tight integration with editing and support for debugging PowerShell code.
These shells:
can all be configured separately
may differ in their default behavior
only some of them allow you to specify startup parameters, such as -NoProfile in your case.
The default shells are:
For the integrated terminal and running tasks:
Windows: PowerShell.
Note that if a PowerShell (Core) 6+ version is found to be installed, it takes precedence over the built-in Windows PowerShell edition.
Unix-like platforms: the user's default shell, as reflected in the SHELL environment variable.
For the external terminal:
Windows: conhost.exe, which launches cmd.exe (Command Prompt)
Unix-like platforms: the host platform's default terminal application, such as Terminal.app on macOS, which itself determines what shell to launch (though, by default, it is also the user's default shell).
Note: On Windows only you may specify a shell (rather than a terminal) executable directly (e.g., bash.exe), in which case it opens in a regular console window (conhost.exe)
The following excerpt from a Settings.json file (> Preferences: Open Settings (JSON)) shows the relevant settings for each (as of VSCode v1.60 / PowerShell Extension v2021.8.2):
In earlier VSCode versions, the "terminal.integrated.shell.*" and "terminal.integrated.shellArgs.*" settings determined the default shell and its startup arguments for the integrated terminal. These have been superseded by shell profiles, defined via "terminal.integrated.profiles.*" properties, and an associated "terminal.integrated.defaultProfile.*" property that contains the name of the profile to use by default, as shown below.
{
// ...
// **General-purpose integrated-terminal shell**.
// Shell *profiles* define the *available* shells for the integrated terminal.
// This property is situationally created automatically, platform-appropriately,
// based on what shells VSCode finds in standard locations on your
// system.
// However, it *need not be present* in a given file - VSCode
// knows about about *standard* profiles *implicitly* when it
// comes to choosing a default shell.
// This example applies to Windows, and shows that Git Bash
// was found on the system.
// On Unix-like platforms, replace ".windows" with ".osx" or ".linux",
// as appropriate.
// To add custom profiles:
// * In file *paths*, use "\\" or "/" as the path separator.
// * Use an "args" array property to specify start-up arguments, if necessary.
"terminal.integrated.profiles.windows": {
"PowerShell": {
"source": "PowerShell",
"icon": "terminal-powershell"
},
"Command Prompt": {
"path": [
"${env:windir}\\Sysnative\\cmd.exe",
"${env:windir}\\System32\\cmd.exe"
],
"args": [],
"icon": "terminal-cmd"
},
"Git Bash": {
"source": "Git Bash"
}
}
// Define the *default* shell profile, which serves as the default
// shell in the *integrated terminal* and - except
// if overridden, as shown below - also for *tasks*.
"terminal.integrated.defaultProfile.windows": "PowerShell"
// **Automation-tasks shell**,
// for the tasks defined in "tasks.json" and for debugging:
// This definition is *optional* and *overrides* the default shell configured above.
// Note:
// * The *executable file path* must be specified (just the file name is sufficient for executables present in %PATH%);
// that is, this setting doesn't reference the shell *profiles*.
// * While "args" technically allows you to pass startup arguments,
// tasks will *blindly append* "/d /c <command>" (for "cmd.exe")
// "-Command <command>" (for PowerShell) to these startup arguments,
// which can *break* the overall invocation if the args
// you specify include *commands* to execute, not just *options*.
// Note: "terminal.integrated.automationShell.<platform>" is DEPRECATED.
"terminal.integrated.automationProfile.windows": {
"path": "cmd.exe"
}
// **External-terminal executable**:
// The *terminal program* to use for opening an external terminal window, which itself determines what shell to launch.
// (> Open New External Terminal).
// Note:
// * The *executable file path* must be specified (just the file name is sufficient for executables present in %PATH%);
// * There is NO way to pass startup arguments.
// * This example specifies Windows Terminal (wt.exe).
// * On Windows only, you may also specify a *shell* executable directly,
// which then opens in a regular console window (conhost.exe)
"terminal.external.windowsExec": "wt.exe",
// **PowerShell Integrated Console**:
// Profile loading is *disabled* by default; you can enable it here, but
// note that the PowerShell Integrated Console has its own,
// separate $PROFILE location, which differs from the one in a
// regular console window. If you want to load your regular profile,
// place the following statement in the $PROFILE file of
// the Integrated Console:
// . ($PROFILE -replace '\.VSCode', '.PowerShell')
// (Open the profile file for editing by submitting the following command
// from the Integrated Console:
// code $PROFILE
// )
"powershell.enableProfileLoading": false,
// ...
}
If you want to configure the PIC (PowerShell Integrated Console) to use a different PowerShell edition / version:
Note: Written as of version v2022.6.3 of the PowerShell extension.
GUI method:
Make sure that a PowerShell source-code file is the active editor.
Click on {} in the status bar (the bottom right corner), then click on Show PowerShell Session Menu in the tooltip window that pops up, as shown below.
Alternatively, irrespective of whether the active editor contains PowerShell source code or not, submit PowerShell: Show Session Menu in the command palette to open the relevant menu.
)
If the session menu is pinned as an icon (use the pushpin icon on the right edge of the tooltip window to toggle), it looks something like this, reflecting the active version number, and clicking it directly opens the PowerShell session menu in the command palette:
)
This opens the PowerShell session menu in the command palette: Choose from the other available versions, if any, which are prefixed with Switch to:, which makes that version the default going forward.
If the version / edition of interest isn't shown, you must add its executable path either via the Settings GUI - by selecting Modify list of additional PowerShell locations from the PowerShell session menu - or via your settings.json file (see next section).
Via settings.json (> Preferences: Open Settings (JSON)):
The powershell.powerShellAdditionalExePaths setting is a single object that allows you to add the full executable paths of PowerShell versions that the extension couldn't find automatically by self-chosen property names - see example below.
The powershell.powerShellDefaultVersion property determines which version to use by default, which is either the name of property of the powershell.powerShellAdditionalExePaths setting or that of an auto-discovered version, as shown in the session menu. Selecting a Switch to: entry from the menu automatically updates this setting.
{
// ...
// The paths to any PowerShell executables that the extension cannot auto-discover.
// The property names are self-chosen names, which show in the
// PowerShell session menu.
// Note:
// * Executable paths only are supported, not also arguments.
// * If a value isn't a valid executable path, it is ignored,
// and the version doesn't show up in the session menu.
// In the status bar, the currently active version is displayed by its actual characteristics,
// not by these self-chosen property names; e.g.,
// "PowerShell 7.2")
"powershell.powerShellAdditionalExePaths": {
"Latest Preview": "C:\\Users\\jdoe\\AppData\\Local\\Microsoft\\powershell\\pwsh.exe"
},
// The PowerShell version to use by default, which can be
// a property name from "powershell.powerShellAdditionalExePaths" or
// the name of an auto-discovered version, as show in the PowerShell
// session menu.
"powershell.powerShellDefaultVersion": "Latest Preview",
// ...
}
You can go in powershell extension settings and remove check box at "PowerShell: Enable Profile Loading", i think it help. Also check task for runs powershell scripts with some parameters discussion about task

VS Code - Shortcut to change the current directory in the PowerShell console to the currently opened file? [duplicate]

This question already has answers here:
How to quickly change shell folder to match the currently open file
(5 answers)
Closed 3 years ago.
I am running the PowerShell extension in Visual Studio Code with its PowerShell Integrated Console attached. I have two PowerShell scripts each open in separate tabs. The files are located in different directories.
I would like to quickly change the current directory to the currently active tab in the PowerShell console using a keyboard shortcut (e.g. Ctrl+Alt+D).
How does one accomplish this?
UPDATE: This is the best solution so far
(Thanks to Mark in the comments of the original post.)
In the keybindings.json file, add the following key binding:
{
"key": "ctrl+alt+d",
"command": "workbench.action.terminal.sendSequence",
"args": {"text": "cd \"${fileDirname}\"\u000D"}
}
This works in both cmd and PowerShell consoles.
(The only flaw is that it does not change the directory across drives for the cmd console only).
UPDATE 2:
A new command will be added in v1.39 workbench.action.terminal.newWithCwd, see add terminal here command. The example keybinding given is:
{
"key": "cmd+shift+h",
"command": "workbench.action.terminal.newWithCwd",
"args": {
"cwd": "${fileDirname}"
}
}
This will create a new terminal, not change the current terminal.
Previous answer
Credit goes to SeeminglyScience for this answer.
There is not currently a way to set a keyboard shortcut, but since that is not explicitly stated in the title, I will post another shortcut.
If you do not already have a file called Microsoft.VSCode_profile.ps1 in your "%UserProfile%\Documents\WindowsPowerShell" directory, create one.
Create a custom PowerShell editor command by adding the following to the Microsoft.VSCode_profile.ps1 file:
Register-EditorCommand -Name 'ChangeDirHere' -DisplayName 'Change to the Directory of the Current File' -ScriptBlock {
Set-Location ([System.IO.Path]::GetDirectoryName($psEditor.GetEditorContext().CurrentFile.Path))
}
Restart VS Code.
Open any PowerShell file.
Press Alt+Shift+S (or whatever keybinding you have for "Powershell: Show Additional Commands from PowerShell Modules").
Select the custom command from the drop-down list of PowerShell commands.

How to add anaconda powershell to vscode?

I'm trying to add anaconda prompt to start up instead of powershell to avoid having to add python to env variables.
"terminal.integrated.shellArgs.windows": [
<args>
]
I tried putting them into single line, splitting them "-Foo Goo" as well as "-Foo","Goo". Each version leads to either error or simply ignoring the "-Command" parameter (the lines simply get pasted, but not executed).
First of all, I I'd like to give a hint for everyone that uses PowerShell to use the new one.
So, with the Anaconda ready to go (and it been equal or greater than 4.6 - use conda --version) run in sequence (from base environment in cwd terminal):
conda update conda
conda init
This will update your conda root environment and the init will setup all you need to run it on both cwd and powershell.
After this, you can start any powershell (inside vscode or not) and it will be conda ready.
Look at this article for further information.
Hope it helps!
I ended up using this (although it has tendency to break).
"terminal.integrated.shellArgs.windows": [
"-ExecutionPolicy"
, "ByPass"
, "-NoExit"
, "-Command"
, "& 'C:\\ProgramData\\Anaconda3\\shell\\condabin\\conda-hook.ps1' ; conda activate 'C:\\ProgramData\\Anaconda3'"
],
Thanks Zerg! Your answer worked for me but I also got a warning message to say that this approach has been depreciated. After some googling I got this working by adding a new terminal profile to settings.json.
"terminal.integrated.profiles.windows": {
"PowerShell (Anaconda)": {
"source": "PowerShell",
"args": [
"-ExecutionPolicy"
, "ByPass"
, "-NoExit"
, "-Command"
, "& 'C:\\Users\\<username>\\AppData\\Local\\Continuum\\anaconda3\\shell\\condabin\\conda-hook.ps1' ; conda activate 'C:\\Users\\<username>\\AppData\\Local\\Continuum\\anaconda3'"
]
}
},
Then changing the default profile:
"terminal.integrated.defaultProfile.windows": "PowerShell (Anaconda)",
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:
From the VSCode Command Palette (Ctrl+Shift+P), select
Terminal: Select default shell
and then pick PowerShell.
Then from the Command Palette (Ctrl+Shift+P), select
Python: Select Interpreter
and pick one of the conda environments. When you now open a new terminal VSCode starts PowerShell and activates the selected environment. This is exactly what the Anaconda-Prompt does. However, you should not set a PYTHONPATH in the environment in combination with an Anaconda install. Conda activation is all you need. It not only adds the selected interpreter to the PATH, but the required libraries too.

How to change the integrated terminal in Visual Studio code

I want to change integrated terminal to CMDER i use VS Code on Windows 8.1.
I checked the docs and also preference file, but I am confused
which line to change.
External Terminal
// Customizes which terminal to run on Windows.
"terminal.external.windowsExec": "%COMSPEC%",
// Customizes which terminal application to run on OS X.
"terminal.external.osxExec": "Terminal.app",
// Customizes which terminal to run on Linux.
"terminal.external.linuxExec": "xterm",
Integrated Terminal
// The path of the shell that the terminal uses on Linux.
"terminal.integrated.shell.linux": "sh",
// The command line arguments to use when on the Linux terminal.
"terminal.integrated.shellArgs.linux": [],
// The path of the shell that the terminal uses on OS X.
"terminal.integrated.shell.osx": "sh",
// The command line arguments to use when on the OS X terminal.
"terminal.integrated.shellArgs.osx": [],
// The path of the shell that the terminal uses on Windows. When using shells shipped with Windows (cmd, PowerShell or Bash on Ubuntu), prefer C:\Windows\sysnative over C:\Windows\System32 to use the 64-bit versions.
"terminal.integrated.shell.windows": "C:\\Windows\\system32\\cmd.exe",
// The command line arguments to use when on the Windows terminal.
"terminal.integrated.shellArgs.windows": [],
// Controls the font family of the terminal, this defaults to editor.fontFamily's value.
"terminal.integrated.fontFamily": "",
// Controls whether font ligatures are enabled in the terminal.
"terminal.integrated.fontLigatures": false,
// Controls the font size in pixels of the terminal, this defaults to editor.fontSize's value.
"terminal.integrated.fontSize": 0,
// Controls the line height of the terminal, this number is multipled by the terminal font size to get the actual line-height in pixels.
"terminal.integrated.lineHeight": 1.2,
// Controls whether the terminal cursor blinks.
"terminal.integrated.cursorBlinking": false,
// Controls whether locale variables are set at startup of the terminal, this defaults to true on OS X, false on other platforms.
"terminal.integrated.setLocaleVariables": false,
// A set of command IDs whose keybindings will not be sent to the shell and instead always be handled by Code. This allows the use of keybindings that would normally be consumed by the shell to act the same as when the terminal is not focused, for example ctrl+p to launch Quick Open.
"terminal.integrated.commandsToSkipShell": [
"editor.action.toggleTabFocusMode",
"workbench.action.debug.continue",
"workbench.action.debug.restart",
"workbench.action.debug.run",
"workbench.action.debug.start",
"workbench.action.debug.stop",
"workbench.action.quickOpen",
"workbench.action.showCommands",
"workbench.action.terminal.clear",
"workbench.action.terminal.copySelection",
"workbench.action.terminal.focus",
"workbench.action.terminal.focusNext",
"workbench.action.terminal.focusPrevious",
"workbench.action.terminal.kill",
"workbench.action.terminal.new",
"workbench.action.terminal.paste",
"workbench.action.terminal.runSelectedText",
"workbench.action.terminal.scrollDown",
"workbench.action.terminal.scrollDownPage",
"workbench.action.terminal.scrollToBottom",
"workbench.action.terminal.scrollToTop",
"workbench.action.terminal.scrollUp",
"workbench.action.terminal.scrollUpPage",
"workbench.action.terminal.toggleTerminal"
],
To change the integrated terminal on Windows, you just need to change the terminal.integrated.shell.windows line:
Open VS User Settings (Preferences > User Settings). This will open two side-by-side documents.
Add a new "terminal.integrated.shell.windows": "C:\\Bin\\Cmder\\Cmder.exe" setting to the User Settings document on the right if it's not already there. This is so you aren't editing the Default Setting directly, but instead adding to it.
Save the User Settings file.
You can then access it with keys Ctrl+backtick by default.
It is possible to get this working in VS Code and have the Cmder terminal be integrated (not pop up).
To do so:
Create an environment variable "CMDER_ROOT" pointing to your Cmder
directory.
In (Preferences > User Settings) in VS Code add the following settings:
"terminal.integrated.shell.windows": "cmd.exe"
"terminal.integrated.shellArgs.windows": ["/k", "%CMDER_ROOT%\\vendor\\init.bat"]
I know is late but you can quickly accomplish that by just typing Ctrl+Shift+P and then type "default" - it will show an option that says:
Terminal: Select Default Shell
It will then display all the terminals available to you.
From Official Docs
Correctly configuring your shell on Windows is a matter of locating
the right executable and updating the setting. Below is a list of
common shell executables and their default locations.
There is also the convenience command Select Default Shell that can be
accessed through the command palette which can detect and set this for
you.
So you can open a command palette using ctrl+shift+p, use the command Select Default Shell, then it displays all the available command line interfaces, select whatever you want, VS code sets that as default integrated terminal for you automatically.
If you want to set it manually find the location of executable of your cli and open user settings of vscode(ctrl+,) then set
"terminal.integrated.shell.windows":"path/to/executable.exe"
Example for gitbash on windows7:
"terminal.integrated.shell.windows":"C:\\Users\\stldev03\\AppData\\Local\\Programs\\Git\\bin\\bash.exe",
For OP's terminal Cmder there is an integration guide, also hinted in the VS Code docs.
If you want to use VS Code tasks and encounter problems after switch to Cmder, there is an update to #khernand's answer. Copy this into your settings.json file:
"terminal.integrated.shell.windows": "cmd.exe",
"terminal.integrated.env.windows": {
"CMDER_ROOT": "[cmder_root]" // replace [cmder_root] with your cmder path
},
"terminal.integrated.shellArgs.windows": [
"/k",
"%CMDER_ROOT%\\vendor\\bin\\vscode_init.cmd" // <-- this is the relevant change
// OLD: "%CMDER_ROOT%\\vendor\\init.bat"
],
The invoked file will open Cmder as integrated terminal and switch to cmd for tasks - have a look at the source here. So you can omit configuring a separate terminal in tasks.json to make tasks work.
Starting with VS Code 1.38, there is also "terminal.integrated.automationShell.windows" setting, which lets you set your terminal for tasks globally and avoids issues with Cmder.
"terminal.integrated.automationShell.windows": "cmd.exe"
I was successful via settings > Terminal > Integrated > Shell: Linux
from there I edited the path of the shell to be /bin/zsh from the default /bin/bash
there are also options for OSX and Windows as well
#charlieParker - here's what i'm seeing for available commands in the command pallette
If you want to change the external terminal to the new windows terminal, here's how.
The method explained in the accepted answer has been deprecated, now the new recommended way to configure your default shell is by creating a terminal profile in #terminal.integrated.profiles.windows# and setting its profile name as the default in #terminal.integrated.defaultProfile.windows#.
The old method will currently take priority over the new profiles settings but that will change in the future.
See an example for powershell taken from the docs
{
"terminal.integrated.profiles.windows": {
"My PowerShell": {
"path": "pwsh.exe",
"args": ["-noexit", "-file", "${env:APPDATA}PowerShellmy-init-script.ps1"]
}
},
"terminal.integrated.defaultProfile.windows": "My PowerShell"
}
change external terminal
windows terminal , which has been mentioned by others, is an alternative of alacrity, which is a terminal (emulator)
As stated in vscode, Cmder is a shell, just like powershell or bash.
"terminal.integrated.profiles.windows": {
"cmder": {
// "path": "F:\\cmder\\Cmder.exe", // 这样会开external terminal
"path": "C:\\WINDOWS\\System32\\cmd.exe",
"args": ["/K", "F:\\cmder\\vendor\\bin\\vscode_init.cmd"]
}
},
"terminal.integrated.profiles.linux": { "zsh": { "path": "zsh" }, },
"terminal.integrated.defaultProfile.windows": "PowerShell",
The statment in cmder' repo is misleading
Different shells under a terminal:
If you want to change the external terminal to the new windows terminal, here's how.
Probably it is too late but the below thing worked for me:
Open Settings --> this will open settings.json
type terminal.integrated.windows.shell
Click on {} at the top right corner -- this will open an editor where this setting can be over ridden.
Set the value as terminal.integrated.windows.shell: C:\\Users\\<user_name>\\Softwares\\Git\\bin\\bash.exe
Click Ctrl + S
Try to open new terminal. It should open in bash editor in integrated mode.
Working as of 02-Dec-2021.
In settings.json
{
"go.toolsManagement.autoUpdate":true,
"terminal.integrated.profiles.windows":{
"My Bash":{
"path":"D:\\1. Installed_Software\\Git\\bin\\bash.exe"
}
},
"terminal.integrated.defaultProfile.windows":"My Bash"
}
Reference: https://code.visualstudio.com/docs/editor/integrated-terminal#_terminal-profiles