简体   繁体   English

Visual Studio Code 无法从 Powershell 打开

[英]Visual Studio Code fails to open from Powershell

I'm trying to open Visual Studio Code from Powershell using the code command while inside a folder.我正在尝试在文件夹内使用code命令从 Powershell 打开 Visual Studio Code。 When I try to do this, I always get this error:当我尝试这样做时,我总是收到此错误:

Blockquote code : The term 'code' is not recognized as the name of a cmdlet, function, script file, or operable program.块引用代码:术语“代码”不是 cmdlet、函数、脚本文件或可运行程序的名称。 Check the spelling of the name, or if a path was included, verify that the path is correct and try again.检查名称的拼写,或者如果包含路径,请验证路径是否正确,然后重试。 At line:1 char:1 + code .在 line:1 char:1 + code 。 + ~~~~ + CategoryInfo : ObjectNotFound: (code:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException + ~~~~ + CategoryInfo : ObjectNotFound: (code:String) [], CommandNotFoundException +fullyQualifiedErrorId : CommandNotFoundException

When you install Visual Studio Code, there is a checkbox in the installer labeled:安装 Visual Studio Code 时,安装程​​序中有一个复选框,标记为:

Add to PATH (requires shell restart)添加到 PATH(需要重新启动 shell)

安装程序映像

Make sure this is checked, and that you restart any active shell instances after installation is completed.确保选中此项,并在安装完成后重新启动所有活动的 shell 实例。

I found a closed GitHub issue ( https://github.com/Microsoft/vscode/issues/22881 ) with the exact same problem and the solution for the person who asked for a solution was:我发现了一个封闭的 GitHub 问题 ( https://github.com/Microsoft/vscode/issues/22881 ) 与完全相同的问题,寻求解决方案的人的解决方案是:

Go to File > Preferences > Settings

Change the property "terminal.integrated.shell.windows" as follows:
      "terminal.integrated.shell.windows": "C:\Windows\System32\cmd.exe"

Restart visual studio.

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法从 Visual Studio 代码打开 Powershell 对话框 - Cant open Powershell dialog box from Visual Studio code 如何从 PowerShell 控制台中使用 Visual Studio Code 打开文件? - How to open a file with Visual Studio Code from within a PowerShell console? PowerShell:从 Visual Studio Code 运行脚本有效,从 PS 命令行运行失败 - PowerShell: Running Script from Visual Studio Code Works, Running from PS Command Line Fails 有没有办法从 NPM 脚本打开 Visual Studio 代码内部 powershell window? - Is there a way to open a Visual Studio Code internal powershell window from NPM Script? 在脚本文件夹中打开Visual Studio Code Powershell终端 - Open Visual Studio Code Powershell Terminal in script folder 从 Visual Studio 打开命令提示符而不是 Powershell 来执行 python - Open command prompt from Visual Studio instead of Powershell for python execution 从终端调试 Visual Studio Code PowerShell 代码 - Visual Studio Code PowerShell code debugging from the terminal “files.defaultLanguage”:“powershell”无法在 Mac 1.24.1 上为 Visual Studio Code 设置默认语言为 PowerShell - "files.defaultLanguage": "powershell" fails to set default lanaguage to PowerShell for Visual Studio Code on Mac 1.24.1 Powershell / Visual Studio Code:Visual Studio Code 中 Powershell 的更新版本 - Powershell / Visual Studio Code: Update version of Powershell in Visual Studio Code Visual Studio 代码:Powershell 新手 - Visual Studio Code: Powershell Greenhorn
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM