Visual Studio Code fails to open from Powershell

与世无争的帅哥 提交于 2021-02-19 06:12:48

问题


I'm trying to open Visual Studio Code from Powershell using the code command while inside a folder. 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. 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 . + ~~~~ + CategoryInfo : ObjectNotFound: (code:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException


回答1:


When you install Visual Studio Code, there is a checkbox in the installer labeled:

Add to PATH (requires shell restart)

Make sure this is checked, and that you restart any active shell instances after installation is completed.




回答2:


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:

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.


来源:https://stackoverflow.com/questions/59162082/visual-studio-code-fails-to-open-from-powershell

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!