CmdPal: Applications are launched with an outdated PATH
Microsoft PowerToys version
0.94.2
Installation method
WinGet
Area(s) with issue?
Command Palette
Steps to reproduce
- Launch PowerToys.
- Add binary to PATH (i.e. install something like Swift that updates PATH for new binaries).
- Launch VS Code
- Through CmdPal:
swiftWill not be recognized. - Through Powershell or Start Menu:
swiftWill be recognized.
✔️ Expected Behavior
A new CmdPal-launched process should have access to an updated PATH.
❌ Actual Behavior
Processes are launched with outdated PATH unless PowerToys is restarted.
Additional Information
No response
Other Software
VS Code 1.106.0
I would consider this a standard expectation in most software- it must be restarted to recognize an updated PATH. Powershell also will not recognize swift if it was launched prior to updating your PATH.
Understandable. Just wanted to report it in case it wasn't expected behavior.
@lpaulino07 Great point! Since Command Palette runs as a persistent process and launcher, it should keep its PATH environment variable up to date to ensure newly installed tools are immediately accessible without the need to restart itself.
I would agree that the expected behavior would be for Command Palette to mirror the behavior of another launcher like the start menu itself, since it is supposed to be able to replace the start menu IMO.
Will start work on this, aiming to have a fix within the week
PowerToys: 0.102.3101.0 Zed: 1.28.1 stable Windows: Windows 11 Home 26H2, build 26300.9974 Integrated shell: PowerShell 7.7.0
Just wanted to throw my own details on this here. I ran through having PowerToys launched with both non-administrator and administrator privileges. Both administrator and non-administrator runs produced identical results; Start picked up the change, Command Palette stayed stale until PowerToys restarted.
Reproduction transcript - PowerToys running without administrator privileges
Establish baseline setup
Variable changed through the settings GUI:
- Start
- Search enrionment variables
- Select Edit environment variables for your account
- Add new user variable name:
CMDPAL_ENV_PROBEvalue:before - Click ok button to close the variable edit pop-up
- Click ok button to close the Environment variables window
- Ensure Zed and PowerToys are fully quit
- Launch PowerToys
Zed Launched Via Command Palette - Baseline
PS C:\Users\Username> Get-Date -Format o
2026-11-17T14:41:55.5438126-05:00
PS C:\Users\Username> $env:CMDPAL_ENV_PROBE
before
PS C:\Users\Username> [Environment]::GetEnvironmentVariable('CMDPAL_ENV_PROBE', 'User')
before
Zed Fully Closed - Environment Variable Updated - Zed Relaunched Via Command Palette
CMDPAL_ENV_PROBEvalue:beforechanged toCMDPAL_ENV_PROBEvalue:afterwithin the settings GUI. Clicking ok on the edit pop-up, and ok on the Environment variables window.
PS C:\Users\Username> Get-Date -Format o
2026-11-17T14:43:23.3121176-05:00
PS C:\Users\Username> $env:CMDPAL_ENV_PROBE
before
PS C:\Users\Username> [Environment]::GetEnvironmentVariable('CMDPAL_ENV_PROBE', 'User')
after
Zed Fully Closed - Zed Relaunched Via Start Menu
PS C:\Users\Username> Get-Date -Format o
2026-11-17T14:44:33.7994437-05:00
PS C:\Users\Username> $env:CMDPAL_ENV_PROBE
after
PS C:\Users\Username> [Environment]::GetEnvironmentVariable('CMDPAL_ENV_PROBE', 'User')
after
Zed Fully Closed - Zed Relaunched Via Command Palette(again)
PS C:\Users\Username> Get-Date -Format o
2026-11-17T14:45:10.0506893-05:00
PS C:\Users\Username> $env:CMDPAL_ENV_PROBE
before
PS C:\Users\Username> [Environment]::GetEnvironmentVariable('CMDPAL_ENV_PROBE', 'User')
after
Zed Fully Closed PowerToys Fully Closed + Re-Launched - Zed Relaunched Via Command Palette
PS C:\Users\Username> Get-Date -Format o
2026-11-17T14:46:18.3181506-05:00
PS C:\Users\Username> $env:CMDPAL_ENV_PROBE
after
PS C:\Users\Username> [Environment]::GetEnvironmentVariable('CMDPAL_ENV_PROBE', 'User')
after
Will start work on this, aiming to have a fix within the week
It's been like 7 months or so, I got busy lol. From the time I did take a look at it, found two practical solutions, just haven't implemented.
- WM_SETTINGCHANGED - Have CmdPal listen for the settings update window message like explorer does, and update PATH manually.
- Explorer COM Magic - Use COM to have explorer launch the program for us. Would mimic start menu more closely.
Each has its own downsides, but good leads IMO.
Will start work on this, aiming to have a fix within the week
It's been like 7 months or so, I got busy lol. From the time I did take a look at it, found two practical solutions, just haven't implemented.
1. [WM_SETTINGCHANGED](https://devblogs.microsoft.com/oldnewthing/20150915-00/?p=91591/) - Have CmdPal listen for the settings update window message like explorer does, and update PATH manually. 2. [Explorer COM Magic](https://devblogs.microsoft.com/oldnewthing/20131118-00/?p=2643/) - Use COM to have explorer launch the program for us. Would mimic start menu more closely.Each has its own downsides, but good leads IMO.
Precedent for option 1 already in Powertoys Run
Will start work on this, aiming to have a fix within the week
It's been like 7 months or so, I got busy lol. From the time I did take a look at it, found two practical solutions, just haven't implemented.
1. [WM_SETTINGCHANGED](https://devblogs.microsoft.com/oldnewthing/20150915-00/?p=91591/) - Have CmdPal listen for the settings update window message like explorer does, and update PATH manually. 2. [Explorer COM Magic](https://devblogs.microsoft.com/oldnewthing/20131118-00/?p=2643/) - Use COM to have explorer launch the program for us. Would mimic start menu more closely.Each has its own downsides, but good leads IMO.
Precedent for option 1 already in Powertoys Run
For what it's worth, I did some digging through Command Palette's launch path earlier and found a few things that might be useful:
-
All Apps runs inside the Command Palette UI process. The built-in application provider is instantiated directly in App.xaml.cs.
-
Desktop applications launch through
Process.Start(). In AppCommand.cs, the launch path usesUseShellExecute = true, without an explicit environment refresh beforehand. -
Command Palette already handles
WM_SETTINGCHANGE. However, the handler in MainWindow.xaml.cs appears to handle font/icon metrics rather than environment changes.
I also came across the existing PowerToys Run implementation in EnvironmentHelper.UpdateEnvironment(), which handles merging machine/user variables, deleted variables, process-specific overrides, and variable expansion.
That looks like a useful precedent for option 1. One caveat is that refreshing Command Palette's own environment may not be sufficient by itself: with UseShellExecute = true, the resulting environment depends on the shell execution path and whether it uses Command Palette's updated environment or delegates launching elsewhere.
I haven't tested a patch or verified that propagation behavior, but the existing message handler and PowerToys Run helper seem like reasonable starting points.