Claude Windows Path Issues | where claude and How to Set Up PATH

The most common stumbling block right after installing Claude or Claude Code on Windows is the path. You type claude and get "command not found." You write a path in your MCP config file and nothing happens. You pass a folder under OneDrive and it reads from somewhere else entirely. All of these are rooted in Windows-specific "path" behavior. This article consolidates — based on official Anthropic documentation — the actual location of claude.exe, how to add the right directory to your PATH environment variable, and how to write file paths inside config files, all in one place.

AI-generated article summarypowered by Claude
結論powered by Claude

"Path" issues around Claude on Windows fall into two distinct categories: the PATH environment variable and file paths inside config files. The first is about whether the OS can find the claude executable at all. The second is about whether claude_desktop_config.json or settings.json — used to connect external tools and files to Claude via MCP (Model Context Protocol) — correctly points to your workspace. These two problems require completely different solutions.

The location of claude.exe depends on how you installed it. A native install puts it at %USERPROFILE%\.local\bin\claude.exe; an npm global install puts it at %APPDATA%\npm\claude.exe. Running where claude tells you instantly which claude is being picked up from your PATH. If PATH comes up empty, add the directory containing the executable to your user environment variables and reopen your shell.

On the config file side, the two main pitfalls are home folders synced under OneDrive and backslash escaping inside JSON. When OneDrive redirects Documents or Desktop, the path shown in Explorer may differ from the actual path on disk, causing MCP servers to fail on startup even when the path looks correct. Inside JSON, use double backslashes \\ or forward slashes /. When in doubt, run claude doctor — it checks your PATH, dependencies, and authentication state all at once.

目次 (10)

Two Kinds of "Path" on Windows

Path-related questions about Claude almost always fall into one of two categories:

  1. The PATH environment variable — the list of directories the OS searches when you run a command. If you see "The term 'claude' is not recognized as the name of a cmdlet…", this is the problem.
  2. File paths inside config files — the absolute paths to workspaces, commands, and credentials written in claude_desktop_config.json or Claude Code's settings.json. MCP servers failing to start are almost always caused by incorrect paths here. Note: MCP (Model Context Protocol) is the mechanism that connects Claude to external tools and files. For the full MCP setup procedure, see Claude Windows MCP Configuration.

These two are fundamentally different problems with different solutions. The first half of this article covers the PATH environment variable; the second half covers file paths inside config files. If you haven't installed Claude yet, start with Install Claude on Windows. For the overall MCP flow, read Claude Windows MCP Configuration first, and each section here will make more sense.

The Location of claude.exe Depends on How You Installed It

When claude isn't found, the first step is to know where the actual executable lives. The typical paths for each installation method, as listed on the official Setup page, are:

Installation method Typical location of claude.exe
Native (PowerShell irm one-liner) %USERPROFILE%\.local\bin\claude.exe
WinGet Under C:\Program Files\WindowsApps\Anthropic.ClaudeCode_*\
npm global (npm i -g @anthropic-ai/claude-code) %APPDATA%\npm\claude.exe

With the native installer, the main data is extracted to %USERPROFILE%\.local\share\claude\, and claude.exe is a thin wrapper that calls into it. With npm, the executable is at the path returned by npm config get prefix plus \claude.exe. If you've installed via multiple methods, which one actually runs depends on the order of entries in your PATH — updating one may leave you running an older claude.exe from the other. Use where claude (described below) to audit what you have, then remove anything unnecessary.

Use where claude to Check the Executable and PATH

To find out which claude you're actually running, Windows gives you several options:

# The classic where command — lists all matches if there are multiple
where claude

# PowerShell built-in — also shows version and file extension
Get-Command claude | Select-Object Source, Version

# See all directories currently in PATH
$env:Path -split ';'

If where claude returns nothing, your PATH does not include the directory where claude.exe lives. If it returns multiple lines, the first one takes priority — check whether an unintended path (such as an old npm global install) is winning. This is the Windows equivalent of which claude on Mac/Linux, and most people who hit trouble stop here. Rather than jumping straight to a reinstall, run these three commands first to understand the current state.

How to Permanently Add the Missing Directory to PATH

If where claude returns nothing, the executable exists but its directory isn't registered in PATH. On Windows, the standard approach is to add it to the user environment variable:

  1. Identify the directory containing claude.exe (for a native install: %USERPROFILE%\.local\bin; for npm: the output of npm config get prefix). Open it in Explorer and visually confirm that claude.exe is there.

  2. Run the following in a PowerShell session without administrator rights to prepend it to your user PATH:

    $Path = [Environment]::GetEnvironmentVariable('Path', 'User')
    $NewPath = "$env:USERPROFILE\.local\bin;$Path"
    [Environment]::SetEnvironmentVariable('Path', $NewPath, 'User')
    
  3. Close all open terminals and VS Code windows, then reopen them — environment variable changes only take effect in new sessions.

  4. Run where claude again and confirm the expected path appears.

To do this through the GUI: press Win + X → System → Advanced system settings → Environment Variables, then edit the Path entry under User variables and add a new row with the directory. System environment variables (Machine-scope) require administrator rights and affect all users — only use those if you're setting this up for everyone on a shared PC. If you need to switch between multiple versions of Claude or always want a specific claude.exe, you can skip touching PATH altogether and instead add Set-Alias -Name claude -Value "$env:USERPROFILE\.local\bin\claude.exe" -Force to your PowerShell profile ($PROFILE).

The "Same Path But It Fails" Problem Under OneDrive

When you set up Windows 11 with a Microsoft account, Documents and Desktop are often automatically redirected to C:\Users\<name>\OneDrive\Documents and similar. The path you get by dragging from Explorer's "Documents" folder may differ from the actual path on disk, and pasting that into MCP folder settings is a frequent cause of failures.

You can reliably get the actual path from PowerShell:

# Actual path to Documents
[Environment]::GetFolderPath('MyDocuments')

# Resolve the real path of any folder (handles symlinks and OneDrive redirects)
Resolve-Path "$env:USERPROFILE\Documents"

Always use the output of these commands — not what Explorer shows — when filling in paths in claude_desktop_config.json or settings.json. There's also another OneDrive pitfall: if Files On-Demand is enabled, files may appear to be there but live only in the cloud. When that happens, MCP servers can't open them and fail. Right-click the folder and select "Always keep on this device" to fix this.

Write Windows Paths in Config Files with \\ or /

When writing Windows paths into MCP server definitions in claude_desktop_config.json or into Claude Code's settings.json (located at %USERPROFILE%\.claude\settings.json), JSON escaping errors are a common trap.

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "C:\\Users\\YourName\\Projects"
      ]
    }
  },
  "env": {
    "CLAUDE_CODE_GIT_BASH_PATH": "C:\\Program Files\\Git\\bin\\bash.exe"
  }
}

Two things to remember. First, backslashes must always be doubled as \\ (per the JSON spec) — sequences like \U or \P are escape errors. Second, paths containing spaces are fine as-is — since they're already inside a JSON string delimited by double quotes, you don't need to add extra quoting around C:\\Program Files\\.... Forward slashes / also work since the Windows API accepts them, so writing "C:/Users/YourName/Projects" is perfectly valid if you prefer readability. When passing a path under OneDrive, use Resolve-Path from the previous section as the base, then convert backslashes to \\.

CLAUDE_CODE_GIT_BASH_PATH tells Claude Code explicitly where to find bash.exe from Git for Windows, and you only need it if auto-detection fails. If Git for Windows isn't installed, Claude Code automatically falls back to PowerShell as the shell, so this setting isn't needed.

Use claude doctor for an All-in-One Health Check

Once you've worked through the path issues above, claude doctor can verify everything in one shot:

claude doctor

This command reports the location of claude.exe and whether it's on PATH, the state of your authentication token (under %USERPROFILE%\.claude\), whether dependencies like ripgrep are resolved, and the shell type (PowerShell / Git Bash / CMD) and version. If claude seems to be found but behaves unexpectedly, checking claude doctor output first will often surface the real cause — expired auth, a missing dependency, or something other than PATH — faster than digging manually. If claude doctor itself says "command not found," PATH isn't set up yet — go back to the "How to Permanently Add the Missing Directory to PATH" section above.

Frequently Asked Questions

Q. Should I type claude or claude.exe? A. Either works in PowerShell and CMD as long as the directory is in PATH. They're equivalent. Only use claude.exe explicitly if you're setting up an alias with Set-Alias and need to point directly at the file.

Q. I changed my installation method and now I have two copies of claude. A. If where claude shows multiple hits, uninstalling the unwanted one is the cleanest fix. For npm: npm uninstall -g @anthropic-ai/claude-code. For a leftover native install: Remove-Item "$env:USERPROFILE\.local\bin\claude.exe". Also remove the now-empty directory from PATH.

Q. Can I run WSL's claude and the native Windows claude side by side? A. Yes, they coexist without conflict. WSL's claude uses WSL's $PATH; the Windows version uses the Windows PATH — they're independent. The only thing to watch is that when calling from VS Code, behavior differs depending on whether the integrated terminal is WSL or PowerShell.

Sources

参考になったら ♡
Clauder Navi 編集部
@clauder_navi

Anthropic の Claude / Claude Code を中心に、日本のエンジニア向けに最新動向と実務 を毎日発信。 運営方針 は メディアについて をご覧ください。