Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to change the shell that opens when using keybinding Ctrl + Shift + c in Visual Studio Code?

I've noticed this code in the keyboard shortcut settings. { "key": "ctrl+shift+c", "command":"workbench.action.terminal.openNativeConsole" },

I was wondering, instead of opening cmd.exe, can I change it to open Powershell?

like image 825
Rene Padillo Avatar asked May 01 '15 07:05

Rene Padillo


People also ask

How do I change the shortcut code in Visual Studio?

All keyboard shortcuts in VS Code can be customized via the keybindings. json file. To configure keyboard shortcuts through the JSON file, open Keyboard Shortcuts editor and select the Open Keyboard Shortcuts (JSON) button on the right of the editor title bar. This will open your keybindings.

How do I change my Ctrl shortcut keys?

Press the TAB key repeatedly until the cursor is in the Press new shortcut key box. Press the combination of keys that you want to assign. For example, press CTRL plus the key that you want to use.


2 Answers

Starting in v1.1.0, we can now configure the external shell.

Before version 1.6.1, there was only one setting.

"externalTerminal.windowsExec": "powershell"

Starting with version 1.6.1, there is an external and internal terminal setting. Using the value "%COMSPEC%", one could instead change their COMSPEC environment variable.

// 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.external.windowsExec": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",

// 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\\WindowsPowerShell\\v1.0\\powershell.exe"

I found, however, that it opens the 32bit Powershell.exe. Which, for me, did not have its execution policy set. So I set it using the following...

I elevated my permissions (Powershell's version of sudo):

Start-Process Powershell -Verb Runas

Then, in the new elevated Powershell window:

Set-ExecutionPolicy RemoteSigned
like image 143
Nathan Hartley Avatar answered Oct 14 '22 23:10

Nathan Hartley


At the moment, the customization is more geared towards changing the keys / conditions that trigger the actions, rather than adding new actions.

It would be great to be able to create custom actions too - and the Visual Studio Code team are interested in hearing ideas on their User Voice site.

I have added a suggestion for custom actions.

like image 25
Fenton Avatar answered Oct 15 '22 00:10

Fenton