Why does an environment-variable change in one terminal not appear in another?
Quick answer
A terminal session has its own process environment. In PowerShell, a process inherits environment variables from its parent, and a change in one PowerShell session affects that session; another terminal session can therefore have a different value. [S1] Think of a session’s environment as something passed to child processes, not as a live shared setting. Details can differ among shells and operating systems.
The question, the details, the next step.
A practical checklist
Confirm which shell and operating system each terminal is using.
Compare the same variable name in both sessions before changing anything.
Use a clearly disposable name such as
GEEZ_SCOPE_TESTfor the comparison.Set and inspect the test value in one PowerShell session, then inspect it in the other.
Remove the test variable from the session where you set it.
For a lasting Windows setting, verify the relevant scope and version-specific instructions first.
A few more useful answers
Does opening another terminal copy changes from my current terminal?
Not as a live shared update. A new process inherits environment from its parent, while a separate terminal session can have a different environment. [S1]
Does a child process inherit its parent’s environment?
In the PowerShell behavior described here, environment variables are inherited by child processes. [S1] The source does not establish every shell’s or operating system’s details.
Is a PowerShell process variable the same as a Windows user or machine setting?
No. Windows distinguishes user and machine scopes from process scope. [S1] The comparison exercise uses a temporary process variable, not a persistent user or machine setting.
Sources
References used for this guide.
- [S1] PowerShell environment-variable scopes and child-process inheritance learn.microsoft.com · Checked
