Visual Studio Code How to change to windows terminal - visual-studio-code

I am new to visual studio code and my terminal always shows integrated ubuntu LTS terminal in windows instead of windows terminal.
I searched google and followed some steps like Press F1 in the search entered "Terminal: Select Default Profile" and when i selected "windows command prompt" but still it shows ubuntu LTS terminal. How to change this to windows command prompt terminal.

Try this it will set the default terminal
Press F1
Type "Terminal"
Select "Configure Terminal Settings"
Select "Integrated"

Check this document, it should lead you to select integrated terminal.
https://code.visualstudio.com/docs/editor/integrated-terminal

Related

Cannot open terminal in VS Code

I need to open a terminal in Visual Studio. I've tried
Re-installing VS Code
The usual Windows shut down / restart
Run vs code as admin
Change settings.json file
I didn't change anything but something is broken in my code Editor help needed :)
For Windows users:
Open PowerShell terminal (windows button + r -> cmd)
Right click on the title bar
Open properties
Check the "Use legacy console" checkbox
For Linux users:
Open VS Code
Ctrl + ,
Search env and find Terminal > Integrated> Env: Linux
Add this "terminal.integrated.inheritEnv": true to the object body
Press ctrl + `. It might work, and if it doesn't, try reinstalling the vs-code again and then try the above key combo again.

Visual Studio code after Update to 1.60.0 Integrated Terminal Issue (CWD)

After an update to version 1.60.0 the integrated terminal that I use by default (WSL Ubuntu 20) gives problems.
If I set WSL as the default Terminal, the right terminal (WSL Ubuntu) is started only if I click on "Open new Terminal".
If I close VSL and reopen it, a power shell is automatically launched.
If I use the function on an file: "open in integrated Terminal" a power shell is always launched, VSL seems to ignore the CWD parameter:
terminal.integrated.cwd ":" $ {fileDirname} for WSL-Ubuntu.
This is due to a regression introduced in 1.60.0 and fixed in 1.60.1, which has just been released (see the updated release note).
So you just have to update VS Code to the latest version.

How do I get around the verified bug in Windows 1903 and launch the VSCode integrated terminal?

I just did a fresh install of Windows 10 Pro version 1903 build 18362.116 and Visual Studio Code. Now the integrated terminal only launches externally.
Pressing Ctrl + ~ results in this.
What am I missing? How do I get it to open integrated again?
EDIT
After working with VSCode team it is a verified bug. See the Github issue here. I posted the workaround as an answer here.
OK, worked through this one in VSCode repo issues.
For now, until it's fixed, turn off ConPTY integration in the User Settings.
💥💥💥
The issue now says use legacy console. To change the setting open a cmd prompt. Right click the title to bring up properties.
Then Uncheck 'Use legacy console'
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.
Check if "terminal.integrated.shell.windows" has value "C:\\Bin\\Cmder\\Cmder.exe" setting to the User Settings document on the right.
Remove this line.
Ctrl + ~ will now open integrated terminal of VSCode.
If the above solution doesn't work then can you try below values and check if it works for you:
// Command Prompt
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe"
// PowerShell
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
// Git Bash
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"
// Bash on Ubuntu (on Windows)
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\bash.exe"
From the Command Palette (Ctrl+Shift+P), use the View: Toggle Integrated Terminal command.
Try custom shortcut:
[
{
"key": "ctrl+`",
"command": "workbench.action.terminal.toggleTerminal"
}
]
Had this problem fixed. Found the solution from the VS Code support.
for error:
Terminal exits with code 3221225786 (or similar)#
"This can happen when you have legacy console mode enabled in conhost's properties. To change this, open cmd.exe from the start menu, right-click the title bar, go to Properties and under the Options tab, uncheck Use legacy console."
source: VS Code docs

How to set mintty.exe as the default terminal on Windows?

I am trying to set the https://github.com/mintty/mintty terminal installed by Cygwin as the default Visual Studio Code terminal with:
"terminal.integrated.shell.windows": "D:\\Cygwin\\bin\\mintty.exe",
But it opens the Mintty.exe terminal on a new window, instead of show it as an embedded console.
Related thread I found about it:
How to change the integrated terminal in visual studio code or VSCode
How to Integrate babun shell in VS code
Is it possible to configure Babun/ZSH for the integrated terminal on Windows?
How to integrate terminal whth babun on windows?
You should use "D:\\Cygwin\\bin\\bash.exe" instead of mintty
cheers.
There are two terminal settings, you may want set them like this:
"terminal.external.windowsExec": "D:\\cygwin64\\bin\\mintty.exe",
"terminal.integrated.shell.windows": "D:\\cygwin64\\bin\\bash.exe",

Visual Studio Code, how to switch from powershell.exe to cmd.exe

I would like to switch from powershell.exe to cmd.exe in the terminal but i'm not sure how to do so. Provided screenshot for clarification.
Press Ctrl+Shift+P to show all commands.
Type profile in the displayed text box to filter the list.
Select Terminal: Select Default Profile.
You will be prompted to Select your preferred terminal shell, you can change this later in your settings or follow the same process as we do now
Select Command Prompt (cmd.exe)
Click the Delete Icon in the shell pane to remove the existing terminal.
Press Ctrl+` (or View > Terminal in menu) to open a new terminal pane.
Add this user settings to your File -- Prefernces -- User Settings
// Place your settings in this file to overwrite the default settings
{
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",
}
2021 Update:
Hit Ctrl+Shift+P
Type/Paste : Terminal: Select Default Profile
Select the command prompt from the drop down list.
Thanks! :)
I found two different ways to switch from powershell to command prompt in VSCode.
Very simple steps i found my self as below:
First one is very simple way:
Press Ctrl+` (or View > Terminal in menu) to open a
new terminal pane.
Click terminal selection dropdown and click 'Select Default Shell'.
Choose terminal type Command Prompt or PowerShell
Now Delete current opened terminal or open new terminal.
Now, Command Prompt will be your default shell in VSCode.
Second one is also simple and handy for all devs.
Press Ctrl+Shift+P to show all commands.
Type shell in the displayed text box to filter the list.
Select Terminal: Select Default Shell.
You will be prompted to Select your preferred terminal shell, you can change this later in your settings or follow the same process as we do now
Select Command Prompt (cmd.exe)
Click the Delete Icon in the shell pane to remove the existing terminal.
Press Ctrl+` (or View > Terminal in menu) to open a new terminal pane.
open settings (ctrl+comma)
find terminal.integrated.shell.windows
replace its value with C:\\Windows\\System32\\cmd.exe
I also faced this problem that when I clicked on terminal. It was showing Powershell but not Command Prompt, so I did the following steps to get Command Prompt in Visual Studio:
View -> Command palette -> Toggle Integrated Terminal
Open terminal by shortcut ctrl+`
or View -> terminal
Write the command as cmd.exe and run
In the current terminal ,simply type cmd and enter. And you are done.
From Visual Studio if you have powershell set as your default integrated terminal, after you call it with Ctrl-` (control backtick) - that toggles from the terminal to your files panel and back. Call the terminal, It will show as 1: pwsh in the dropdown box. From the powershell command line type bash and enter. You have your bash prompt $. In the dropdown you now see 1: bash.
You can type cmd from either the ps C: or the $ bash prompt and open the windows command prompt. C:> and exit to exit them.
You can open up multiple terminals. Say powershell (pwsh) is your default one. A new terminal will show as 2: pwsh which you can change to a cmd one. The same if you open a third. Change it to bash. You now have 3 terminals 1: pwsh, 2: cmd, and 3: bash. You can select whichever one you want to work with from the dropdown. You can of course exit any of them.
No doubt you've seen that when you are running node.js, the terminal becomes node.