Machine and User Path variables are not combined in $Env:Path on restart

Stian Michael 0 Reputation points
2023-01-11T12:57:42.57+00:00

Recently whenever I add something to the User Path variable I cannot use it in CMD or Powershell however the System/Machine Path seems to work fine.

When I print out the $Env.Path or do "echo %PATH%" I only get the Machine / system Path without the User Path. Other User environment variables seem to work fine when echoed except for the Path variable.

I can temporarily fix it by writing:
"$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")"

However, this does not fix the fact that applications I use are dependent on the variable and after every restart of the computer and opening a new shell it again only shows the Machine / System Path and not the combined path for System and User.

I have discovered that if I run the CMD or Powershell in elevated priviledges (admin) they get the combined Path. However, with regular priviledges it is not working.

Windows for business Windows Client for IT Pros User experience Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Stian Michael 0 Reputation points
    2023-01-12T00:34:41.85+00:00

    I managed to fix this issue in the end.

    If anyone has a similar issue. Make sure that all paths in the env file are working and not linking to a removed folder. Remove dead links or try to resolve them. Remove duplicates. I also removed from the user path items that are already in the System Path.

    One or all of these made it eventually work for me. Good luck ;)

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.