1

According to Setting Windows PowerShell environment variables it is possible to modify environment path in Powershell with

$env:Path = "C:\jdk-16.0.1\bin" + ';' + $env:Path

I tried (with admin rights) and checked $env:Path : it's ok

But if I close and reopen powershell, it's gone so did I miss something ?

user310291
  • 36,946
  • 82
  • 271
  • 487
  • 3
    Use `[Environment]::SetEnvironmentVariable()` to persist env vars, as detailed by [this answer](https://stackoverflow.com/a/2571200/7571258). – zett42 May 28 '22 at 18:02
  • 2
    Alternatively, if you want to set an environment variable only for PowerShell, but not all other processes, add `$env:Path = ...` to your `$Profile` file. See https://stackoverflow.com/a/714918/7571258 – zett42 May 28 '22 at 18:05

0 Answers0