有没有办法在Visual Studio代码中使用键绑定Ctrl + Shift + c时更改打开的shell?

Ren*_*nsz 8 visual-studio-code

我在键盘快捷键设置中注意到了这段代码. { "key": "ctrl+shift+c", "command":"workbench.action.terminal.openNativeConsole" },

我想知道,而不是打开cmd.exe,我可以将其更改为打开Powershell吗?

Nat*_*ley 5

从v1.1.0开始,我们现在可以配置外部shell.

在1.6.1版之前,只有一个设置.

"externalTerminal.windowsExec": "powershell"
Run Code Online (Sandbox Code Playgroud)

从版本1.6.1开始,有一个外部和内部终端设置.使用值"%COMSPEC%",可以改为更改其COMSPEC环境变量.

// 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"
Run Code Online (Sandbox Code Playgroud)

但是,我发现它打开了32位Powershell.exe.对我来说,没有设置执行策略.所以我用以下设置它......

我提升了我的权限(Powershell的sudo版本):

Start-Process Powershell -Verb Runas
Run Code Online (Sandbox Code Playgroud)

然后,在新升级的Powershell窗口中:

Set-ExecutionPolicy RemoteSigned
Run Code Online (Sandbox Code Playgroud)


Fen*_*ton 3

目前,定制更适合于更改触发操作的键/条件,而不是添加新操作。

如果能够创建自定义操作那就太好了 - Visual Studio Code 团队有兴趣在他们的User Voice 网站上听取想法。

我添加了自定义操作的建议