Windows: shell commands run from C:\ while Codex UI shows project directory (relative paths break) (bug?)
What version of Codex CLI is running?
v0.106.0
What subscription do you have?
Plus
Which model were you using?
gpt-5.3-codex
What platform is your computer?
Windows 10, x64, (PowerShell)
What terminal emulator and version are you using (if applicable)?
Rider, PowerShell
What issue are you seeing?
Codex CLI on Windows shows one working directory in the header, but executes shell commands from a different directory (C:\).
This breaks relative paths and can produce incorrect answers about file existence.
What steps can reproduce the bug?
- Open PowerShell in a project directory on drive E: (or any non-C: path), for
example:
cd "E:\\\Project"
pwd
- Start Codex
- Confirm Codex header shows:
directory: E:\\\Project
- Run/ask Codex to run:
Get-Location
and
Test-Path '@Assets\some-directory\some-file'
- Observe that Get-Location reports C:\, and relative path checks are resolved
from C:\ instead of the directory shown in the header.
Minimal reproducible snippet inside Codex shell:
Get-Location
Test-Path 'Assets\some-directory\some-file'
Test-Path E:\\\Project\some-directory\some-file'
Observed:
- Get-Location => C:\
- relative Test-Path => False
- absolute Test-Path => True
<img width="1028" height="1174" alt="Image" src="https://github.com/user-attachments/assets/19ae673f-034c-468c-aae0-3ddb4620fbc9" />
What is the expected behavior?
If Codex header shows directory: E:\\\Project\, then shell commands should execute with that same working directory.
Get-Location should return the same directory shown in the header, and relative paths like Assets\Project\some-file should resolve correctly from project root.
P.S. Or am I missing something? I'm still new to using the CLI.
Additional information
_No response_
3 Comments
Same issue here
Codex v0.125.0 started from PowerShell in Windows Terminal
<img width="1306" height="700" alt="Image" src="https://github.com/user-attachments/assets/8e217b39-08c9-41b2-8ec5-4824c22b3493" />
This issue is VERY annoying. Is there a workaround? I'm about to change to Linux because of this.
@Xalalau @ueruxon @morch1 @fcoury @genki
I think I found the cause and fixed it.
My Windows Documents folder had been moved to the D: drive. Codex was running shell commands as a sandbox user like
DESKTOP-<PC_NAME>\codexsandboxoffline.That user could access the project directory directly, e.g.
D:\<WindowsUser>\Documents\<ProjectName>, but it could not traverse the parent directoriesD:\<WindowsUser>andD:\<WindowsUser>\Documents.Because of that,
Set-Location D:\<WindowsUser>\Documents\<ProjectName>failed withAccess is denied, so the shell cwd remainedC:\. Then relative commands likergorGet-Content AGENTS.mdwere resolved fromC:\instead of the project directory.Granting the sandbox user traversal/read permissions on the parent directories, or moving the project to a path whose parent directories are accessible to the sandbox user, fixed the issue for me.