How to open a shell command prompt inside Visual Studio Code?

Visual Studio-Code

Visual Studio-Code Problem Overview


When using Visual Studio Code, how do I run command-line programs, such as a choco (Chocolatey) command? Do I need to have a separate Command Line (CMD.exe) running outside VS Code, or is there a hotkey/window within Code where I can run those commands?

I see the "Command Palette", but it is not entirely clear what command engines run in that palette.

Visual Studio-Code Solutions


Solution 1 - Visual Studio-Code

For integrated console use Ctrl+`

From the release notes: > With the May release, we are rolling out the initial version of an integrated terminal. You can open the terminal using Ctrl+`, from the View | Toggle Integrated Terminal menu, or from the View > Toggle Integrated Terminal command in the Command Palette.

https://code.visualstudio.com/updates#_workbench

Solution 2 - Visual Studio-Code

Use CMD+Shift+C or CTRL+Shift+C but it will only open a new outside editor standard bash console.

I hope they will implement an integrated console.

Solution 3 - Visual Studio-Code

Can open it with this menu options: View > Integrated Terminal

Default keyboard shortcut for integrated terminal is Ctrl+`

In vscode you can use multiple integrated terminals.
If you want open another one use Ctrl+Shift+`

vscode keys shortcuts are rendered assuming a standard US keyboard layout. If you use a different keyboard layout, [please read how][1] can see the representation in your current keyboard. It's easy, open this menu options: File > Preferences > Keyboard Shortcuts and on the Default Keyboard Shortcut search the command workbench.action.terminal.toggleTerminal then point you mouse to info icon and can see the combination. For me is Ctrl+ñ because I'm using Spanish keyboard layout.

[![enter image description here][2]][2]

Also it's cool create an personal shortcuts to toggle into terminals. Open this menu options: File > Preferences > Keyboard Shortcuts and on the keybinding.json tab put this:

[    {        "key": "ctrl+pageup",        "command": "workbench.action.terminal.focusNext",        "when": "terminalFocus"    },{        "key": "ctrl+pagedown",        "command": "workbench.action.terminal.focusPrevious",        "when": "terminalFocus"    }]

Now when the cursor are focus on terminal, and have more than one terminal, you can navigate through every one with the combinations Ctrl+Page Down for previous terminal and Ctrl+Page Up for next terminal.

Tip: If you are focus on the editor, the same keyboard shortcuts can be used to navigate through tabs.

[1]: https://code.visualstudio.com/docs/customization/keybindings#_keyboard-layouts "please read how" [2]: http://i.stack.imgur.com/VUgD2.png

Solution 4 - Visual Studio-Code

@brady321's answer is only for US keyboards:

>Note: The following keys are rendered assuming a standard US keyboard layout.(https://code.visualstudio.com/Docs/customization/keybindings)

For instance, UK keyboards use Ctrl+':

You can find your shortcut in File > Preferences > Keyboard Shortcuts searching for workbench.action.terminal.toggleTerminal. If you're not using a US keyboard, it will show you the equivalent shortcut using your keyboard layout:

enter image description here

To check what the shortcut to open a native console looks like, try to find workbench.action.terminal.openNativeConsole in the shortcuts file.

>More information about integrated terminal at: https://code.visualstudio.com/docs/editor/integrated-terminal

Solution 5 - Visual Studio-Code

As MCBL wrote, there is no integrated console. You can vote for this feature here: UserVoice - Integrated terminal <-- dead link.

3rd party Edit

Uservoice is no longer used and the link above is dead. The feature request for an integrated terminal might be this one.

Solution 6 - Visual Studio-Code

test with the Ctrl + J keys in ubuntu

Solution 7 - Visual Studio-Code

In the contrary you may also run a terminal inside your visual studio code tool by simply doing the following:

Go to " View > Integrated Terminal " or use the shortcut key " Ctrl + ' "

I believe this is available on later versions of visual studio code. I could do this on version 1.7.0-insider.

Solution 8 - Visual Studio-Code

For mac Cmd + j
For win Ctrl + j

Solution 9 - Visual Studio-Code

Ctrl+ `

> Integrated Terminal In Visual Studio Code, you can open an integrated > terminal, initially starting at the root of your workspace. This can > be very convenient as you don't have to switch windows or alter the > state of an existing terminal to perform a quick command line task. > > To open the terminal: > >

Solution 10 - Visual Studio-Code

I am using vsCode 1.9.1. there are 2 ways as I know

  1. You can easily open it by hitting Ctrl + ` key.
  2. Go to View->Integrated Terminal like below image

terminal for vscode

Solution 11 - Visual Studio-Code

Test this, This works for me

Ctrl + ñ

Ctrl + `

ctrl + j

Solution 12 - Visual Studio-Code

On my UK MacBook, when I look in my keyboard shortcuts for VS Code (Code > Preferences > Keyboard Shortcuts), Toggle Integrated Terminal has the keybinding Crtl+`.

However, the shortcut works on Ctrl+§, which is the key on my MacBook that is the same place as the ` on a UK Windows keyboard.

You can take the text editor of the Microsoft, but you can't take the etc, etc.

Solution 13 - Visual Studio-Code

Go to File > Preferences > Keyboard Shortcuts or use shortcut Ctrl+K Ctrl+S.

Type to search in keybindings : workbench.action.terminal.new.

Double click on Keybinding and add the shortcut you want (Super+T is unused in default config).

Solution 14 - Visual Studio-Code

Since the Debug Console does not support programs that need to read input from the console, you can enable an external, native console by setting the attribute externalConsole to true in your launch configuration. lauch.json just write: "externalConsole" : true

Solution 15 - Visual Studio-Code

I used custom shortcut. Add below keybind to the keybinds.json:

[    {        "key": "ctrl+,",        "command": "workbench.action.terminal.toggleTerminal"    }]

To open keybinds.json

CTRL + SHIFT + P then type Keyboard and click to Open Keyboard Shortcuts

Solution 16 - Visual Studio-Code

The best way to run command line programs is to use the terminal window provided inside VS Code. This way tou will not switch any apps. But to make switching between terminal and other windows I recommend the following :

  1. To open up a terminal - Ctrl + `
  2. To open up second terminal - when you are running a node script in the first terminal and it is blocked and you need to run second script at the same time - Ctrl + Shift + `
  3. To focus/switch back on terminal without reopening :
    1. Press F1 and then type keyboard shortcuts

    2. Find workbench.action.terminal.focus and set it to Ctrl + </kbd> - this slash is usually located right next to your right Ctrl key. This makes switching between code and terminal very easy because Ctrl + ` and Ctrl + </kbd> are invoked with your right hand and index finger.

Solution 17 - Visual Studio-Code

Switch the Integrated Terminal to CMD

  1. Open the Integrated Terminal: Ctrl + `
  2. If a Bash terminal is opened while you want a Command Prompt (cmd), simply run the command: cmd, in the terminal to switch it to Command Prompt.

enter image description here

Solution 18 - Visual Studio-Code

Also for MAC its Ctrl+Shift+.

I prefer you to change to a custom one.
Open up Command Palette by Command+Shift+P.

Type 'Keyboard Shortcuts...' - Select Preferences: Open Keyboard Shortcuts

enter image description here.
See Terminal: Create New Integrated Terminal option there. Double-tap it to change it to a custom one.

enter image description here. enter image description here

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDan SorensenView Question on Stackoverflow
Solution 1 - Visual Studio-Codebrady321View Answer on Stackoverflow
Solution 2 - Visual Studio-CodeMCBLView Answer on Stackoverflow
Solution 3 - Visual Studio-CodeequimanView Answer on Stackoverflow
Solution 4 - Visual Studio-CodejobmoView Answer on Stackoverflow
Solution 5 - Visual Studio-CodemsallinView Answer on Stackoverflow
Solution 6 - Visual Studio-CodeVesperView Answer on Stackoverflow
Solution 7 - Visual Studio-CodeTechManiacView Answer on Stackoverflow
Solution 8 - Visual Studio-CodekostikovmuView Answer on Stackoverflow
Solution 9 - Visual Studio-CodexgqfrmsView Answer on Stackoverflow
Solution 10 - Visual Studio-Codereza.cse08View Answer on Stackoverflow
Solution 11 - Visual Studio-CodeDarckBlezzerView Answer on Stackoverflow
Solution 12 - Visual Studio-CodeDouglas WaughView Answer on Stackoverflow
Solution 13 - Visual Studio-CodegujouView Answer on Stackoverflow
Solution 14 - Visual Studio-CoderainerView Answer on Stackoverflow
Solution 15 - Visual Studio-CodeCryptoView Answer on Stackoverflow
Solution 16 - Visual Studio-CodeOgnyan DimitrovView Answer on Stackoverflow
Solution 17 - Visual Studio-CodeLoukan ElKadiView Answer on Stackoverflow
Solution 18 - Visual Studio-CodeKiran JasvaneeView Answer on Stackoverflow