Setting Windows PowerShell environment variables

前端 未结 18 1767
日久生厌
日久生厌 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:43

    Most answers aren't addressing UAC. This covers UAC issues.

    First install PowerShell Community Extensions: choco install pscx via http://chocolatey.org/ (you may have to restart your shell environment).

    Then enable pscx

    Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser #allows scripts to run from the interwebs, such as pcsx
    

    Then use Invoke-Elevated

    Invoke-Elevated {Add-PathVariable $args[0] -Target Machine} -ArgumentList $MY_NEW_DIR
    

提交回复
热议问题