On Thu, Dec 24, 2015 at 8:52 AM, Nicky Mac <nmcelwa...@gmail.com> wrote: > seems the user profile PATH is a registry entry, and was not updated when I > deinstalled Python2.7 > still haven't figured out how to change it - I will NOT attempy a regedit.
As to PATH on Windows, it's split into system and user components, which get concatenated (system followed by user) when a profile is loaded at logon. Persisted user environment variables are defined in the user's "Environment" key. This is where PATH should be defined. HKEY_CURRENT_USER\Environment There's also the "Volatile Environment" key where the system stores variables that are defined at logon such as USERNAME, USERPROFILE, and a per-session subkey (e.g. "1" for session 1) that has values such as SESSIONNAME. HKEY_CURRENT_USER\Volatile Environment HKEY_CURRENT_USER (HKCU) references the current user's hive, which is loaded in HKEY_USERS. The entries in HKEY_USERS are named by user SIDs (see "whoami /user"). The user's registry hive is loaded when logged on interactively or otherwise by LoadUserProfile. The hive is physically stored in the user profile directory in the hidden file "%USERPROFILE%\NTUSER.DAT". The system environment is first loaded by the session manager (smss.exe) during boot, so it's a subkey of the session manager's configuration. HKEY_LOCAL_MACHINE\SYSTEM\ CurrentControlSet\Control\Session Manager\Environment The HKLM\SYSTEM hive is located on the system volume at "%SystemRoot%\System32\config\SYSTEM". Don't use regedit to modify the environment unless you plan to reboot the system. Tools that modify the environment know to broadcast a WM_SETTINGCHANGE message to all top-level windows, which makes Explorer reload its environment from the registry. Subsequent processes started by Explorer inherit the updated environment. >From the command line, use "set" to modify the current environment. If you also want the change to be permanent, and for Explorer to be notified, then use setx.exe. In this case you still need cmd's internal "set" in order to modify the current environment. For example, first modify the current PATH. C:\>set MYPATH=C:\Spam;C:\Eggs C:\>set PATH=%PATH%;%MYPATH% Next, inspect the user's PATH in the registry. C:\>reg query HKCU\Environment /v PATH HKEY_CURRENT_USER\Environment PATH REG_EXPAND_SZ %USERPROFILE%\.dnx\bin Run setx.exe to extend this value. Note that "^" is cmd's escape character. C:\>setx MYPATH %MYPATH% SUCCESS: Specified value was saved. C:\>setx PATH ^%USERPROFILE^%\.dnx\bin;^%MYPATH^% SUCCESS: Specified value was saved. Verify that it was set correctly. C:\>reg query HKCU\Environment HKEY_CURRENT_USER\Environment DNX_HOME REG_SZ %USERPROFILE%\.dnx PATH REG_EXPAND_SZ %USERPROFILE%\.dnx\bin;%MYPATH% TEMP REG_EXPAND_SZ %USERPROFILE%\AppData\Local\Temp TMP REG_EXPAND_SZ %USERPROFILE%\AppData\Local\Temp MYPATH REG_SZ C:\Spam;C:\Eggs setx.exe sets the value's type as REG_EXPAND_SZ if it contains at least two "%" characters. It's only well-defined for REG_EXPAND_SZ values to depend on REG_SZ variables (or any system variable in a user variable, since the system environment is loaded first). A registry key is enumerated in arbitrary order (not alphabetic), but the system enumerates the key in two passes, with REG_SZ variables loaded in the first pass. Note that Visual Studio mistakenly set DNX_HOME as a REG_SZ. Thus I have the following useless environment variable: C:\>echo %DNX_HOME% should have been set as REG_EXPAND_SZ. %USERPROFILE%\.dnx should have been set as REG_EXPAND_SZ. -- https://mail.python.org/mailman/listinfo/python-list