A script needs to add a program to the Windows PATH. Another script needs to remove that same program from the Windows PATH. For compatibility issues, the script needs to work on most if not all flavors of Windows.
Which registry key (or keys) consistently store the PATH on a wide range of Windows machine types?
For example, on my Windows 10 Home Edition laptop, the PATH is stored in the Path
property of the following key:
HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
But another user informs me this key is not available on his or her Windows machine.
So what is the complete list of key location possibilities?
Note that the scripts are targeting the keys directly because the changes to the PATH must persist after the end of runtime. Other approaches seem to only temporarily change the PATH while the program is running.