简体   繁体   English

如何将 VSCode 添加到 PowerShell 的 PATH?

[英]How do I add VSCode to the PATH for PowerShell?

The Code documentation suggests that it is added to the PATH during installation, but that did not seem to work for me (at least not in PowerShell).代码文档建议在安装过程中将其添加到 PATH 中,但这似乎对我不起作用(至少在 PowerShell 中不起作用)。 Where is it installed such that I can add it myself?它在哪里安装,以便我可以自己添加?

  • The install path is C:\\Users\\username\\AppData\\Local\\Code安装路径为C:\\Users\\username\\AppData\\Local\\Code
  • C:\\Users\\username\\AppData\\Local\\Code\\bin is added to the PATH by the installer, but it might be that tools such as PowerShell will pick this change up only until after a log off/log on or a restart C:\\Users\\username\\AppData\\Local\\Code\\bin由安装程序添加到PATH ,但可能是 PowerShell 等工具只会在注销/登录或重新启动后才会选择此更改

在 macOS 上,现在 VS Code 似乎有一个 Command Palette (shift + Cmd + P) 命令可以将其安装到名为“Shell Command: Install 'code' command in PATH”的路径。

It seems that a good old restart of the box fixed the issue.似乎旧的盒子重新启动解决了这个问题。 Interestingly, merely restarting PowerShell or logging out and back in didn't fix it.有趣的是,仅仅重新启动 PowerShell 或注销并重新登录并不能解决问题。

Modern Software Installation.现代软件安装。

Many of the larger software packages have finally caught-up with the times.许多较大的软件包终于赶上了时代。 Make sure the correct choice(s) are made during the software download and during the software installation.确保在软件下载和软件安装过程中做出正确的选择。

Most individual PC users are the sole users of their PCs.大多数个人 PC 用户是其 PC 的唯一用户。 Yet many software packages have always defaulted the installation processes to assume otherwise.然而,许多软件包总是默认安装过程以其他方式假设。 This is why so many software packages install to a path that includes C:\\ .... user\\ ...这就是为什么这么多软件包安装到包含 C:\\ .... user\\ ... 的路径的原因。

But most of us individual PC users don't want the software installation including a path that involves using the ... user\\ ... path.但是我们大多数个人 PC 用户不希望软件安装包含涉及使用 ... user\\ ... 路径的路径。 And instead we want the software installed into the default C:\\ path without the "user name".相反,我们希望将软件安装到没有“用户名”的默认 C:\\ 路径中。

Some of the most common software installation packages are becoming available for the individual PC user and these packages install on the PC in our preferred path - (not involving a path through the ... user\\ ... ).一些最常见的软件安装包可供个人 PC 用户使用,这些包安装在 PC 上我们首选的路径中 - (不涉及通过 ... user\\ ... 的路径)。

And if there is not a separate download package for the individual PC user, then during installation make sure to closely read each step which will often now include a checkbox of whether the installation is for a "user" or for "all users".如果个人 PC 用户没有单独的下载包,那么在安装过程中请务必仔细阅读每个步骤,现在通常会包含一个复选框,用于确定安装是针对“用户”还是“所有用户”。 Select all users.选择所有用户。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM