I can confirm with both TC 9.51 32-bit and 64-bit on Win7 Pro x64.
It seems TC only looks for new or changed environment variables when receiving WM_SETTINGCHANGE but does not check for expired environment variables it still holds a copy of.
By the way, manually editing the registry is not required to reproduce the problem.
For convenience, here step-by-step instructions to reproduce the problem using just vbs scripts. (Don't close TC between the steps, keep it running.)
1. Make sure there is no TEST environment variable defined.
2. In TC's command line, enter the following to print the non-existing TEST variable:
Note how it just outputs "%Test%" (which is cmd.exe's "normal" way of echoing an unset environment variable)
3. Run this VBS script with admin privileges:
Code: Select all
Set objShell = WScript.CreateObject("WScript.Shell")
Set objSystemEnv = objShell.Environment("System")
objSystemEnv("Test") = "Kaboom"
4. In TC's command line, again enter the following to print the now existing TEST variable:
This time, as expected, it outputs "Kaboom".
5. Now run this VBS script with admin privileges:
Code: Select all
Set objShell = WScript.CreateObject("WScript.Shell")
Set objSystemEnv = objShell.Environment("System")
objSystemEnv.Remove("Test")
6. In TC's command line, enter once more the following to print the TEST variable (which shouldn't be set anymore):
The output is still "Kaboom", and not "%Test%" as expected.