Setting Windows PowerShell environment variables

前端 未结 18 1917
日久生厌
日久生厌 2020-11-22 11:03

I have found out that setting the PATH environment variable affects only the old command prompt. PowerShell seems to have different environment settings. How do I change the

18条回答
  •  情深已故
    2020-11-22 11:19

    From the PowerShell prompt:

    setx PATH "$env:path;\the\directory\to\add" -m
    

    You should then see the text:

    SUCCESS: Specified value was saved.
    

    Restart your session, and the variable will be available. setx can also be used to set arbitrary variables. Type setx /? at the prompt for documentation.

    Before messing with your path in this way, make sure that you save a copy of your existing path by doing $env:path >> a.out in a PowerShell prompt.

提交回复
热议问题