vscode setting system environment variable startup is invalid

roger shadowdancer 1 Reputation point
2022-11-04T10:32:00.38+00:00

I try to start vscode with cmd, the system info is:

Version Windows 10 Pro

Version number 21H1

Installation Date ‎2021/‎9/‎27

OS Build 19043.2130

Experience Windows Feature Experience Pack 120.2212.4180.0

However, adding relevant environment variables to the path in the system environment variables (as shown by the blue arrows in the figure below) can only achieve the following effects:

  1. Start cmd with administrator privileges to use the "code" command multiple times
  2. Otherwise, it will only be effective if you open cmd for the first time and use the "code" command every time you boot up, and you will be prompted that the command cannot be found.
  3. Other environment variables of the same level can continue to take effect

Only by adding the relevant environment variables to the user's environment variables can you continue to use the code command to open vscode

I would like to ask what is the reason for this?
257252-image.png

(Sorry, there is no tag for vscode)

Community Center Not monitored
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anna Xiu-MSFT 31,056 Reputation points Microsoft External Staff
    2022-11-07T02:14:13.63+00:00

    Hi @roger shadowdancer ,

    The tag “vs-general” is related to Visual Studio, for more questions about Visual Studio Code, please post it to the Stack Overview tagged visual-studio-code forum or GitHub repository where you would get professional support for this product. Thanks for your understanding.

    Sincerely,
    Anna
    *
    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.