Complete Windows file path troubleshooting knowledge for Claude Code on Git Bash and Windows environments. PROACTIVELY activate for: (1) File path errors on Windows, (2) Backslash vs forward slash issues, (3) Edit/Write/Read tool failures, (4) MINGW path resolution, (5) Cross-platform path conversion.
This skill inherits all available tools. When active, it can use any tool Claude has access to.
MANDATORY: Always Use Backslashes on Windows for File Paths
When using Edit or Write tools on Windows, you MUST use backslashes (\) in file paths, NOT forward slashes (/).
Examples:
D:/repos/project/file.tsxD:\repos\project\file.tsxThis applies to:
NEVER create new documentation files unless explicitly requested by the user.
MANDATORY: When using Edit, Write, or Read tools on Windows, you MUST use backslashes (\) in file paths, NOT forward slashes (/).
Windows File Path Requirements:
D:\repos\project\file.tsxD:/repos/project/file.tsxThis applies to:
file_path parameterfile_path parameterfile_path parameterCommon error message when using forward slashes on Windows:
Error: ENOENT: no such file or directory
Root cause:
\) as path separators/) work in some Windows contexts but NOT in Claude Code file toolsSymptom:
Edit tool fails with "file not found" or "no such file or directory"
Cause: Using forward slashes copied from Git Bash output:
# Git Bash shows:
/s/repos/claude-plugin-marketplace/file.tsx
Incorrect usage:
Edit(file_path="/s/repos/myproject/file.tsx")
Correct usage:
Edit(file_path="S:\repos\myproject\file.tsx")
Solution steps:
/s/ ā S:)Symptom:
Paths like /s/repos/ or /c/Users/ don't work in Edit/Write/Read tools
MINGW path format explained:
/c/, /d/, /s/, etc.Conversion table:
| Git Bash (MINGW) | Windows Native |
|---|---|
/c/Users/name/ | C:\Users\name\ |
/d/repos/project/ | D:\repos\project\ |
/s/work/code/ | S:\work\code\ |
/mnt/c/Windows/ | C:\Windows\ |
Conversion algorithm:
/s/ ā S)S ā S:)S: + \repos\project\file.tsxSymptom: Relative paths from Git Bash don't resolve correctly in Claude Code tools
Cause: Git Bash current working directory uses MINGW format, but Claude Code tools use Windows format
Example scenario:
# In Git Bash:
pwd
# Shows: /s/repos/my-project
# User provides relative path:
./src/components/Button.tsx
Problem:
Claude Code can't resolve ./src/ from MINGW /s/repos/my-project
Solution:
pwd -W
# Shows: S:/repos/my-project (Windows format with forward slashes)
S:\repos\my-projectS:\repos\my-project\src\components\Button.tsxSymptom:
Paths with environment variables like $HOME or %USERPROFILE% fail
Git Bash environment variables:
echo $HOME
# Shows: /c/Users/username (MINGW format)
Windows environment variables:
echo %USERPROFILE%
# Shows: C:\Users\username (Windows format)
Best practice:
$HOME, ask them to run echo $HOME and convert the resultSymptom: Paths with spaces break or cause "file not found" errors
Correct handling:
ā
CORRECT: Edit(file_path="C:\Program Files\My App\config.json")
ā
CORRECT: Edit(file_path="D:\My Documents\project\file.txt")
Notes:
Symptom:
Network paths like \\server\share\file.txt fail
Windows UNC format:
\\server\share\folder\file.txt
Git Bash representation:
//server/share/folder/file.txt
Correct usage in Claude Code:
Edit(file_path="\\\\server\\share\\folder\\file.txt")
Note: Backslashes must be doubled in some contexts due to escaping, but Claude Code tools handle this automatically.
When a user provides a file path, follow this decision tree:
MINGW Path (Git Bash):
/ followed by single letter and / (e.g., /c/, /s/)/s/repos/project/file.tsxWindows Path:
C:, D:)S:\repos\project\file.tsx or S:/repos/project/file.tsxRelative Path:
./ or ../ or just filename./src/components/Button.tsxUNC Path:
\\ or //\\server\share\file.txtFor MINGW paths (/x/...):
Input: /s/repos/myproject/src/components/Button.tsx
Process:
1. Extract drive letter: "s"
2. Uppercase: "S"
3. Add colon: "S:"
4. Replace remaining slashes: \repos\myproject\src\components\Button.tsx
5. Combine: S:\repos\myproject\src\components\Button.tsx
Output: S:\repos\myproject\src\components\Button.tsx
For Windows paths with forward slashes (X:/...):
Input: S:/repos/project/file.tsx
Process:
1. Detect drive letter already present: "S:"
2. Replace forward slashes with backslashes: \repos\project\file.tsx
3. Combine: S:\repos\project\file.tsx
Output: S:\repos\project\file.tsx
For relative paths:
Input: ./src/components/Button.tsx
Current directory (from user or detection): S:\repos\my-project
Process:
1. Remove ./ prefix
2. Replace forward slashes: src\components\Button.tsx
3. Combine with current directory: S:\repos\my-project\src\components\Button.tsx
Output: S:\repos\my-project\src\components\Button.tsx
When you encounter a file path error on Windows:
Error indicators:
Ask yourself:
If the path is ambiguous, ask:
I see you're working on Windows with Git Bash. To ensure I use the correct path format,
could you run this command and share the output?
pwd -W
This will give me the Windows-formatted path.
Conversion template:
I'll convert the path from Git Bash format to Windows format:
- Git Bash: /s/repos/project/file.tsx
- Windows: S:\repos\project\file.tsx
Retrying with the correct Windows path...
After conversion, verify the operation succeeded and explain what was fixed:
ā
Successfully edited the file using the Windows path format (S:\repos\...).
Note: On Windows with Git Bash, always use backslashes (\) in file paths for
Claude Code's Edit/Write/Read tools, even though Git Bash displays paths with
forward slashes (/).
When file operations fail on Windows:
\) used instead of forward slashes (/)?C: not /c/?/x/path to X:\path?$HOME or %USERPROFILE%?\\server\share format?| Context | Path Format | Claude Code Tool Format |
|---|---|---|
| Git Bash pwd | /s/repos/project | S:\repos\project |
| Git Bash relative | ./src/file.tsx | S:\repos\project\src\file.tsx |
| Windows Explorer | S:\repos\project\file.tsx | S:\repos\project\file.tsx ā
|
Windows with / | S:/repos/project/file.tsx | S:\repos\project\file.tsx |
| MINGW full path | /c/Users/name/file.txt | C:\Users\name\file.txt |
| Network share (Git Bash) | //server/share/file.txt | \\server\share\file.txt |
| WSL path | /mnt/c/repos/project | C:\repos\project |
Don't wait for errors - If you see a path that looks like MINGW format, convert it immediately:
User provides: /s/repos/project/file.tsx
You think: "This is MINGW format, I need to convert it to S:\repos\project\file.tsx"
You do: Convert before calling Edit/Write/Read tool
When you need current directory on Windows:
# Instead of:
pwd # Shows: /s/repos/project (MINGW format)
# Use:
pwd -W # Shows: S:/repos/project (Windows format with /)
Then convert the forward slashes to backslashes.
Always explain when you convert paths:
I'll convert the Git Bash path to Windows format for the Edit tool:
- From: /s/repos/project/file.tsx
- To: S:\repos\project\file.tsx
This helps users understand the requirement and learn for future interactions.
Before calling Edit/Write/Read tools on Windows:
Pre-flight checklist:
ā
Path starts with drive letter and colon (e.g., C:, S:)
ā
Path uses backslashes (\) not forward slashes (/)
ā
Path is absolute, not relative
ā
No MINGW format (no /c/, /s/, etc.)
User might provide paths in various formats:
Always detect and convert as needed.
Most likely cause: Forward slashes instead of backslashes
Solution:
Most likely cause: MINGW path format
Solution:
/x/ pattern at startX: formatMost likely cause: Path is correct but permissions issue
Solution:
Possible causes:
Solution:
ls -la in Git Bash to verify exact filenamePath characteristics:
\)File.txt same as file.txt< > : " | ? * in filenamesGit Bash is a POSIX-compatible environment:
ls, pwd, cd use POSIX formatKey insight: Git Bash displays and accepts POSIX paths, but Windows APIs (used by Claude Code) require Windows paths.
WSL path mounting:
/mnt/c/, /mnt/d/, etc./mnt/c/Users/name/projectC:\Users\name\projectConversion:
/mnt/x/ with X:When explaining path issues to users, use this template:
I encountered a path format issue. Here's what happened:
**The Problem:**
Claude Code's file tools (Edit, Write, Read) on Windows require paths in Windows
native format with backslashes (\), but Git Bash displays paths in POSIX format
with forward slashes (/).
**The Path Formats:**
- Git Bash shows: /s/repos/project/file.tsx
- Windows needs: S:\repos\project\file.tsx
**The Solution:**
I've converted your path to Windows format. For future reference, when working
with Claude Code on Windows with Git Bash:
1. Use backslashes (\) in file paths
2. Use drive letter format (C:, D:, S:) not MINGW format (/c/, /d/, /s/)
3. Run `pwd -W` in Git Bash to get Windows-formatted paths
**The Fix:**
ā
Now using: S:\repos\project\file.tsx
User is working with both WSL and Git Bash:
Windows symbolic links:
mklink /D C:\link C:\target
Handling:
Docker volume mounts on Windows:
docker run -v C:\repos:/app
Path translation:
C:\repos\file.txt/app/file.txtYou've successfully handled Windows paths when:
PROACTIVELY apply this knowledge when:
/c/, /s/, etc.This skill is CRITICAL for Windows users - Path format errors are the #1 cause of file operation failures on Windows with Git Bash.