powershell get current users path variable

Hi

How I do get the PATH value only for a single user ?

I have two user on my desktop and I want to change the PATH only for the ‘User1’

for example :

$PATH = $env:Path
$PATH += ";" + $jdkInstallFolder +"\bin" #The new folder to add
Set-EnvironmentVariable -name PATH -Value $PATH -Target User
But it doesn't work because It's adding the path of the whole machine to single user Path ( User1)
so I get a double string.
I'm very confused
Can you help me , thanks !

As far as I know Set-EnvironmentVariable is not a built-in cmdlet of Powershell. So you might ask the author of that function to help you.

You could use a dotNet method to achieve what you’re looking for How To Work with Environment Variables in PowerShell

Olaf ! Thanks ! I’ve searched on google , but I didn’t find that article

Solved !