Windows 7 – Environment Variables in PATH Not Expanded for Non-Admin Command Prompt

command-line-interfaceenvironment-variablespathwindows 7

I have a Windows 7 machine which, when Command Prompt is run by a normal user, fails to expand environment variables in the %PATH%. If command prompt is instead run as administrator (right click, Run as administrator) then %PATH% is appropriately expanded.

Specifically, %PATH% for cmd.exe run as the user (displayed via set path) is as follows:

Path=%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\Wbem;%SYSTEMROOT\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft Windows Performance Toolkit\

…whereas %PATH% for cmd.exe run as Administrator is as follows:

Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\Wbem;%SYSTEMROOT\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft Windows Performance Toolkit\

I tried logging in as a new user to create a new profile, and the issue persists on that profile as well. HKEY_CURRENT_USER\Environment\PATH does not exist, and HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\Path matches the defined system-wide path in Computer Properties -> Environment Variables.

Does anyone have any ideas of what this might be, or where I can look?

Best Answer

Two things I might try.

  1. Run an sfc /scannow to see if that fixes any larger issues at play.
  2. Check the registry for the Path key in HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment. What's the type. It should say REG_EXPAND_SZ