Claude Code Can’t Access Windows Files: Fix Path Issues
Claude Code usually can’t read a Windows file because it’s running in a different environment than the file path you gave it. The safest fix is to use the path format that matches that shell, open the project from the same shell, and avoid protected, synced, or otherwise unsupported locations until basic reads work. If you’re in WSL, the most common fix is switching from `C:\repo\file.txt` to `/mnt/c/repo/file.txt`.
What you’re actually seeing when Claude Code can’t reach a Windows file
The problem often looks like a simple file issue, but it usually comes from path translation or an environment boundary. You might see a file-not-found error, an empty read, a command that works in Windows Explorer but fails in Claude Code, or a file that exists on disk but looks invisible from the current terminal.
File not foundSometimes the file name is right and the file really is on your machine, but Claude Code is running in WSL, Git Bash, or a remote session that cannot use that path directly. In other cases, the working directory is wrong, so Claude Code is looking in the right filesystem but the wrong folder. If the file only fails in one shell, that is a strong clue that the shell boundary, not the file itself, is the issue.
When this problem happens and when it doesn’t
This problem is common when Claude Code runs inside WSL and you point it at C:\... paths, when you use Git Bash with a Windows path that the tool interprets differently, or when you are inside a remote, container, or dev environment that does not share your Windows filesystem by default. It also shows up if you opened Claude Code from one shell but are trying to read files from another environment.
Before you start, check these basics:
- Confirm the file really exists where you think it does.
- Confirm which shell Claude Code is running in.
- Confirm whether the project is on the Windows filesystem, the WSL filesystem, or inside a container.
- If the file is in a remote or container session, make sure you are not trying to read across that boundary from Windows directly.
You do not usually need Administrator rights for a path fix, but you may need them if the file sits in a protected folder or a corporate-managed location. No restart is normally required. Back up anything important before you move projects or edit files in place.
The fastest fix: use a path Claude Code can really see
Start with the simplest fix: use the path format that matches the shell Claude Code is actually using. If Claude Code is running in WSL, use /mnt/c/... for Windows drives. If it is running in a Windows terminal, use the Windows path. If it is running in a container or remote session, open the project inside that same environment instead of pointing across boundaries.
- Check where the file lives and which shell you’re in.
- Convert the path to match that shell.
- Try a plain read of the file before retrying the full workflow.
cd /mnt/c/Users/yourname/projects/your-repo
cat README.mdIf that works, Claude Code can see the filesystem and the problem was the path format or the starting directory. If it still fails, the file may be in a protected location, the shell may not have access, or the project may actually be open in a different environment than you thought.
Check whether the file is in a protected or synced folder
Some folders look local but behave differently because of sync clients or policy restrictions. Common trouble spots are OneDrive-backed folders, Desktop, Documents, Downloads, corporate-managed folders, and locations with unusual ACLs or device encryption policies. Files under these locations can exist in Explorer yet fail from a shell that does not have the same view or permissions.
If the file is in OneDrive or another sync folder, try copying it to a plain local path such as a normal project directory on C:\ or inside your WSL home folder. If the copy works, the issue is probably the folder layer, not the file itself.
Avoid testing with sensitive company folders if you are not sure about the policy. Use a throwaway text file in a local dev folder first.
If the copy fails or the file still cannot be read, the problem is more likely a shell mismatch, a permission issue, or a cross-filesystem boundary than the folder itself.
If you’re using WSL, make sure the shell and project live on the same side
WSL is the setup that causes the most confusion because it has two sides: Linux paths inside WSL and Windows paths mounted under /mnt/c, /mnt/d, and so on. If your repo is in C:\dev\repo, then WSL sees it as /mnt/c/dev/repo. If your repo is inside the WSL filesystem, Windows tools will not always handle it the same way.
Pick one side and stay on it for the session. If you are using Claude Code from WSL, open the repo from WSL and use Linux-style paths. If you are using Windows Terminal or PowerShell, keep the workflow in Windows paths. Do not mix C:\... and /mnt/c/... in the same command chain unless you know exactly how that command handles path conversion.
- Open the repo from the same side Claude Code is running on.
- Use that side’s native path style.
- Avoid jumping between Windows paths and Linux paths in one session.
pwd
ls /mnt/c/Users/yourname/projects/your-repoIf pwd shows a WSL path and ls finds the project, you are probably in the right place. If the folder appears empty or the path fails, you may be in the wrong shell, the project may not be mounted where you expect, or you may be hitting a permission boundary between filesystems.
How to verify the fix with one small read test
Before you retry the real task, confirm access with one tiny read. Use a known text file in the same folder as the target, or create a simple test file if needed. The point is to check reading, not to test Claude Code’s full workflow yet.
- Put a small text file in the same directory as the problem file.
- Read it from the same shell Claude Code uses.
- Confirm the output matches what you expect.
cat test-read.txthelloIf you get the file contents back, the path and permission problem is fixed. If you still get an error, compare the exact path you used with the shell’s current working directory and check whether the file sits behind OneDrive, a protected folder, a UNC path, or a cross-filesystem boundary.
Why most guides get this wrong
A lot of advice blames Claude Code itself when the real issue is simpler: the path is valid in one environment and invalid in another. That is why a file can open in Windows Explorer, fail in WSL, and then work again after you move it or use the mounted path.
The other common miss is the working directory. People assume the file path is enough, but if Claude Code starts in the wrong folder, relative paths break and even absolute paths can fail if the environment cannot reach them. A third miss is permissions: the file is there, but the shell session does not have the right access to read that location.
If a guide skips those three checks, it is leaving out the parts that cause most Windows-to-WSL, Windows-to-container, and Windows-to-remote-session failures.
How to stop it from breaking again
The most reliable setup is boring: keep the repo in one filesystem, open Claude Code from that same shell every time, and avoid hopping between Windows paths and Linux paths mid-session. If you use WSL often, keep WSL projects inside the WSL filesystem or always access Windows drives through /mnt/... the same way.
A few habits help:
- Use one project location per toolchain.
- Keep synced folders out of your active dev path if they cause trouble.
- Start Claude Code from the shell you plan to use for the whole session.
- Use short, predictable paths for work in progress.
- Avoid UNC paths and other network-style paths unless you have already confirmed they work in that shell.
If your team uses containers or remote dev sessions, treat them as separate filesystems unless you know the mount rules. That keeps path bugs from coming back every time you switch terminals.
When it’s not a path problem anymore
If the file read works from a plain shell command but Claude Code still cannot use it, you may be looking at a session limitation rather than a Windows file access issue. That can happen with sandboxed commands, restricted tool permissions, a stale Claude Code session, or a workspace that is mounted read-only.
At that point, check whether Claude Code can list the directory, whether the session needs to be restarted, and whether the command you are trying to run is allowed in that environment. If the file exists, the path is correct, and a direct shell read works, then the problem is no longer Windows file access. It is the Claude Code session or its permissions model, and you should debug that layer next.
Conclusion
Try the smallest fix first: use the right path for the shell you are in, then verify it with a simple read command. If that works, move the project to a stable location and keep using one environment for the whole workflow. If it does not, check the session boundary next.
Frequently Asked Questions
Why can I open the file in Windows Explorer but not in Claude Code?
Explorer is using Windows paths and Windows permissions. Claude Code may be running in WSL, Git Bash, a container, or a remote session that sees the filesystem differently, so the same file can be visible in one place and unavailable in another.
What path should I use in WSL for a file on C:?
Use the mounted Linux path, usually `/mnt/c/...`, not `C:\...`. For example, `C:\Users\you\repo\file.txt` becomes `/mnt/c/Users/you/repo/file.txt` inside WSL.
Does OneDrive cause file access problems?
It can. OneDrive, Desktop, Documents, and other synced or protected folders may add permission, availability, or path translation issues. A plain local dev folder is usually safer for troubleshooting.