I've been using GNU Emacs on Windows for many years and in order to make it work, I've always had to define several environment variables. I've had these defined as system variables all this time:
I recently upgraded my Emacs from the "NTEmacs" port of 24.3 to the official GNU port of 26.1 and I've found that the values I was using for these were wrong. Furthermore, the current version can auto-detect all but the EMACSPATH variable.
So I went into the environment variables control panel, changed EMACSPATH to point to the new installation's location and deleted the rest. Emacs now works great.
But I found out that after a logout/login, all of the deleted variables are back, and with the old values. More precisely, they're not in the control panel, but if I open a command prompt and type
set, they're there and the prevent Emacs from working. (Other environment variables I've deleted also come back, but they don't interfere with any of my apps so I don't care as much).
If I modify, add or remove any system environment variable with the control panel, the environment resets to match it and Emacs works again until the next time I log out or reboot.
Clearly, these environment variables are being cached somewhere, but I have no clue where to look in order to completely delete them.
I searched the registry with regedit and couldn't find any trace of these old variables. Is there any place else I should be looking? This is clearly a Windows bug, but I don't want to have to put up with this for as long as it takes for Microsoft to fix it.
I can, of course, get the values Emacs computes and re-create the system environment variables with these values, but I'd prefer to avoid that unless there is no other option available.