在Power Shell重新讀取Windows 環境變數

  • 271
  • 0

 設定好環境變數後,在Power Shell卻沒辦法更新,可以用以下指令重新讀取而不用再 reboot Windows

$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")