Windows Environment is not right
Pre-submit Checks
- [x] I have searched Warp bugs and there are no duplicates
- [x] I have searched Warp known issues page and my issue is not there
- [ ] I have included the logs (optional, but helps expedite the bug fix). Log gathering intructions
Describe the bug
The program under %PATH% may not be found if the path contains macros like %USERPROFILE%
To reproduce
- Add a path contains macro to %PATH%, such as GO's path: %USERPROFILE%\go\bin
- Change directory to any directory other than go\bin, Run any exe under the %USERPROFILE%\go\bin
- Error occurred: The term 'xxx.exe' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Expected behavior
Let me run the exe under the %PATH% directories, without typing the full path.
Screenshots, videos, and logs
Under Warp, when you type: $Env:Path it will return: %USERPROFILE%\go\bin
Under Windows Terminal, type the same command, it will return: C:\Users\xxx\go\bin
That's the difference
Operating system (OS)
Windows
Operating system and version
Windows 11 24H2
Shell Version
Powershell 7.5.0
Current Warp version
v0.2025.03.26.08.10.stable_02
Regression
No, this bug or issue has existed throughout my experience using Warp
Recent working Warp date
No response
Additional context
No response
Does this block you from using Warp daily?
Yes, this issue prevents me from using Warp daily.
Is this an issue only in Warp?
Yes, I confirmed that this only happens in Warp, not other terminals.
Warp Internal (ignore): linear-label:b9d78064-c89e-4973-b153-5178a31ee54e
None
Add a path contains macro to %PATH%, such as GO's path: %USERPROFILE%\go\bin
How did you do this? In Control Panel? In your shell profile file? In the middle of a running session?
Add a path contains macro to %PATH%, such as GO's path: %USERPROFILE%\go\bin
How did you do this? In Control Panel? In your shell profile file? In the middle of a running session?
Just install the GO lang, the installer will set it for you. In the Control Panel you can do it manually.
How did the GO installer do it? Did it add it to %PATH% by editing your shell profile file or did it add it to the registry?
If you restart Warp does the issue persist?
Yes, it add an entry "USERPROFILE%\go\bin under Path of my personal environment. Restart Warp didn't help. The entries of Path which contains variable such as %USERPROFILE% are not expanded to the real path. Compares to Windows Terminal, which expand the variables for entries under Path, I think that's the difference cause command in Warp cannot find the proper target
I presume you have many entries in your %PATH% containing macros. Is %USERPROFILE%\go\bin the only one failing to expand?
I presume you have many entries in your %PATH% containing macros. Is %USERPROFILE%\go\bin the only one failing to expand?
No, i have many entries like %NVM_HOME%, %JAVA_HOME%, %USERPROFILE%... no environment variable is expanded, it just keep the original string.
It's weird because you are the only one having this issue with macro expansion so far (who has reported it).
Can you provide the following?
- The output of the command
Get-ItemProperty -Path 'HKCU:\Environment' -Name PATHfrom any terminal. - The output of the command
Get-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATHfrom any terminal. - The output of
$env:PATHfrom Warp. - The output of
$env:PATHfrom a different terminal. - A screenshot of System Information > Environment variables > PATH, for example...
If you prefer not to post this information publicly on Github, please email to [email protected] and include a link to this issue. Thank you!
It's weird because you are the only one having this issue with macro expansion so far (who has reported it).
Can you provide the following?
- The output of the command
Get-ItemProperty -Path 'HKCU:\Environment' -Name PATHfrom any terminal.- The output of the command
Get-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATHfrom any terminal.- The output of
$env:PATHfrom Warp.- The output of
$env:PATHfrom a different terminal.- A screenshot of System Information > Environment variables > PATH, for example...
If you prefer not to post this information publicly on Github, please email to [email protected] and include a link to this issue. Thank you!
Get-ItemProperty -Path 'HKCU:\Environment' -Name PATH
Path : C:\Users\ianlong\scoop\shims;C:\Users\ianlong\.cargo\bin;%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;%NVM_HOME%;%NVM_SYMLINK%;%USERPROFILE%\.dotnet\tools;C:\Users\ianlong\AppData\Local\Microsoft\WinGet\Packages\Gyan.FFmpeg_Microsoft.Winget.Source_8wekyb3d8bbwe\ffmpeg-6.1-full_build\bin;C:\Users\ianlong\AppData\Local\Programs\oh-my-posh\bin;C:\Users\ianlong\AppData\Roaming\Python\Python312\Scripts;E:\Software\platform-tools;%JAVA_HOME%\bin;C:\Users\ianlong\AppData\Local\Programs\Ollama;%USERPROFILE%\go\bin;C:\Program Files\LLVM\bin;E:\Software\lua;C:\Users\ianlong\AppData\Local\Programs\cursor\resources\app\bin;C:\Users\ianlong\AppData\Local\UGit\app-5.30.2\resources\app\git\cmd;C:\Users\ianlong\AppData\Local\UGit\bin PSPath : Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER\Environment PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER PSChildName : Environment PSDrive : HKCU PSProvider : Microsoft.PowerShell.Core\Registry
Get-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH
Path : C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.3\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.3\libnvvp;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\Program Files\Python312\Scripts\;C:\Program Files\Python312\;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\NVIDIA Corporation\Nsight Compute 2023.3.1\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Users\ianlong\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files\dotnet\;C:\Program Files\Git\cmd;C:\Program Files\RedHat\Podman\;C:\Program Files\NVIDIA Corporation\NVIDIA app\NvDLISR;C:\Program Files\CursorModifier;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\PowerShell\7\;C:\Program Files\Go\bin;C:\Program Files\CMake\bin;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\ PSPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager PSChildName : Environment PSDrive : HKLM PSProvider : Microsoft.PowerShell.Core\Registry
$env:PATH
C:\Program Files\PowerShell\7;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.3\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.3\libnvvp;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\Program Files\Python312\Scripts\;C:\Program Files\Python312\;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\NVIDIA Corporation\Nsight Compute 2023.3.1\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Users\ianlong\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files\dotnet\;C:\Program Files\Git\cmd;C:\Program Files\RedHat\Podman\;C:\Program Files\NVIDIA Corporation\NVIDIA app\NvDLISR;C:\Program Files\CursorModifier;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\PowerShell\7\;C:\Program Files\Go\bin;C:\Program Files\CMake\bin;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Users\ianlong\scoop\shims;C:\Users\ianlong\.cargo\bin;%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;%NVM_HOME%;%NVM_SYMLINK%;%USERPROFILE%\.dotnet\tools;C:\Users\ianlong\AppData\Local\Microsoft\WinGet\Packages\Gyan.FFmpeg_Microsoft.Winget.Source_8wekyb3d8bbwe\ffmpeg-6.1-full_build\bin;C:\Users\ianlong\AppData\Local\Programs\oh-my-posh\bin;C:\Users\ianlong\AppData\Roaming\Python\Python312\Scripts;E:\Software\platform-tools;%JAVA_HOME%\bin;C:\Users\ianlong\AppData\Local\Programs\Ollama;%USERPROFILE%\go\bin;C:\Program Files\LLVM\bin;E:\Software\lua;C:\Users\ianlong\AppData\Local\Programs\cursor\resources\app\bin;C:\Users\ianlong\AppData\Local\UGit\app-5.30.2\resources\app\git\cmd;C:\Users\ianlong\AppData\Local\UGit\bin
$env:PATH in Windows Terminal:
C:\Program Files\PowerShell\7;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.3\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.3\libnvvp;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\Program Files\Python312\Scripts\;C:\Program Files\Python312\;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\NVIDIA Corporation\Nsight Compute 2023.3.1\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Users\ianlong\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files\dotnet\;C:\Program Files\Git\cmd;C:\Program Files\RedHat\Podman\;C:\Program Files\NVIDIA Corporation\NVIDIA app\NvDLISR;C:\Program Files\CursorModifier;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\PowerShell\7\;C:\Program Files\Go\bin;C:\Program Files\CMake\bin;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Users\ianlong\scoop\shims;C:\Users\ianlong\.cargo\bin;C:\Users\ianlong\AppData\Local\Microsoft\WindowsApps;C:\Users\ianlong\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Users\ianlong\.dotnet\tools;C:\Users\ianlong\AppData\Local\Microsoft\WinGet\Packages\Gyan.FFmpeg_Microsoft.Winget.Source_8wekyb3d8bbwe\ffmpeg-6.1-full_build\bin;C:\Users\ianlong\AppData\Local\Programs\oh-my-posh\bin;C:\Users\ianlong\AppData\Roaming\Python\Python312\Scripts;E:\Software\platform-tools;C:\Program Files\Android\Android Studio\jre\\bin;C:\Users\ianlong\AppData\Local\Programs\Ollama;C:\Users\ianlong\go\bin;C:\Program Files\LLVM\bin;E:\Software\lua;C:\Users\ianlong\AppData\Local\Programs\cursor\resources\app\bin;C:\Users\ianlong\AppData\Local\UGit\app-5.30.2\resources\app\git\cmd;C:\Users\ianlong\AppData\Local\UGit\bin
Path of user profile:
Path of system:
More detail:
@loongee What's weird is that if you look at your output for Get-ItemProperty -Path 'HKCU:\Environment' -Name PATH, the macros are not expanded there. This leads me to think that the datatype on your Path in the registry is incorrect? Can you run this command and post the output?
$key = [Microsoft.Win32.Registry]::CurrentUser.OpenSubKey('Environment'); $key.GetValueNames() | ForEach-Object { "$_`: " + $key.GetValueKind($_) }
@acarl005
> $key = [Microsoft.Win32.Registry]::CurrentUser.OpenSubKey('Environment'); $key.GetValueNames() | ForEach-Object { "$_`: " + $key.GetValueKind($_) }
ANDROID_HOME: String
GOPATH: ExpandString
LUA_CPATH: String
LUA_PATH: String
NDK_ROOT: String
NDKROOT: String
NVM_HOME: ExpandString
NVM_SYMLINK: ExpandString
OneDrive: ExpandString
Path: String
POSH_INSTALLER: String
POSH_THEMES_PATH: String
TEMP: ExpandString
TMP: ExpandString
UGIT_HOME: String
Yes, it's really weired why the 'Path' on my computer is String but not ExpandString. After changing the type to ExpandString, Warp works perfectly now.
Thanks for tracking that down with me. It's interesting that Windows Terminal still seemed to expand the macros anyway... Maybe we should special-case the Path to always expand 🤔
Update: yeah here it is in the Windows Terminal source code: https://github.com/microsoft/terminal/blob/06f736bebe84eda0c34b935a875eebe031a899b7/src/inc/til/env.h#L237-L244
This should be fixed in next week's release. Warp will expand path macros even if the registry data type isn't REG_EXPAND_SZ