[Enviroment]::SetEnviromentVariable("Path", "d:/test/bin;c:/test", "Machine"
If the variable already exists with other values in it; how can I adjust this script to not overwrite existing entries. While adding the new additional values?
[Enviroment]::SetEnviromentVariable("Path", "d:/test/bin;c:/test", "Machine"
If the variable already exists with other values in it; how can I adjust this script to not overwrite existing entries. While adding the new additional values?
When i need to add software to env path using powershell, i use this:
[Environment]::SetEnvironmentVariable("Path", [Environment]::GetEnvironmentVariable("Path", "Machine")+";<YOUR_PATH_HERE>", [System.EnvironmentVariableTarget]::Machine)
But i dont know if efficient, pretty sure a better way exist.