How to Install and Use Claude Code on Windows

Software engineer running Claude Code CLI on Windows 11 terminal at an office workstation
How to Install and Use Claude Code on Windows 3

To set up and run claude code windows environments, you can either install the native standalone executable directly in PowerShell or deploy it inside the Windows Subsystem for Linux (WSL 2). The fastest native method is running irm https://claude.ai/install.ps1 | iex in PowerShell, which downloads the official CLI binary, configures background auto-updates, and integrates directly with your local project files. While native Windows gives you immediate access to your system drive without virtualization overhead, WSL 2 remains the recommended option if your software development workflow requires Linux toolchains or strict command sandboxing.

Anthropic designed Claude Code as an agentic command-line interface that inspects codebases, edits files across directories, executes test suites, and automates Git workflows. Operating Claude Code on Windows requires understanding how the CLI interacts with Windows shells, how it locates Git Bash for POSIX compatibility, and how to configure environment variables. This guide covers system requirements, native installation methods, WSL configuration, authentication, and fixes for common Windows runtime errors.

Native Windows vs. WSL 2: Choosing Your Architecture

Before installing the CLI, decide whether to run Claude Code natively in Windows or within a WSL 2 Linux distribution. Both approaches work reliably, but they serve different engineering workflows.

Feature / Requirement Native Windows (PowerShell / CMD) WSL 2 (Ubuntu / Debian)
Installation Command irm https://claude.ai/install.ps1 | iex curl -fsSL https://claude.ai/install.sh | bash
Shell Execution Tool Git Bash (preferred) or PowerShell Native Linux Bash / Zsh
Sandboxing Support Not supported on native Windows Fully supported (Linux kernel cgroups)
File System Access Direct access to C:\, D:\ Fastest in /home/user/, mounts via /mnt/c/
Background Auto-Updates Supported natively Supported natively
Primary Use Case .NET, Visual Studio, native Windows dev Docker, Node.js, Python, Linux cloud stacks

If your project uses Windows-specific tooling or MSBuild compilers, choose the native installation. If you are comparing agent architectures like OpenCode vs Claude Code and need sandboxed shell execution or Docker-heavy microservices, running Claude Code inside WSL 2 provides better isolation.

System Prerequisites

Ensure your system meets the baseline requirements before running the installation:

  • Operating System: 64-bit Windows 10 (Build 1809 or higher), Windows 11, or Windows Server 2019+. Both x64 and ARM64 architectures are supported.
  • Hardware: Minimum of 4 GB RAM and an active broadband internet connection for Anthropic API communication.
  • Terminal: Windows Terminal is strongly recommended over legacy conhost.exe to ensure proper ANSI color rendering and UTF-8 support.
  • Git for Windows: Recommended for native installations so Claude Code can run bash-compatible commands. If absent, Claude Code executes commands via PowerShell.
  • Anthropic Account: A Claude Pro, Team, Enterprise, or Anthropic Console API account. The free web tier does not include CLI access.

Method 1: Installing Claude Code Natively on Windows

Anthropic provides multiple native deployment mechanisms on Windows. The native standalone binary is self-contained and does not require Node.js unless you explicitly choose npm.

Option A: Windows PowerShell (Recommended)

The native PowerShell installer fetches the compiled Windows binary, registers it in your user profile, and configures background auto-updates. Open Windows Terminal with a PowerShell profile (your prompt starts with PS C:\Users\...>) and execute:

irm https://claude.ai/install.ps1 | iex

The installer places the executable at $env:USERPROFILE\.local\bin\claude.exe and keeps version files inside $env:USERPROFILE\.local\share\claude\. Reopen your terminal session to load the updated environment variables.

Option B: Windows Command Prompt (CMD)

If you prefer standard Command Prompt (where your prompt displays C:\Users\...> without PS), run the batch installer:

curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd

Option C: Windows Package Manager (WinGet)

If you manage software through WinGet, install the official package:

winget install Anthropic.ClaudeCode

WinGet packages do not auto-update in the background. Upgrade manually at any time by running winget upgrade Anthropic.ClaudeCode.

Option D: Global npm Package

If Node.js 22+ is already installed on your system, you can install Claude Code as a global package:

npm install -g @anthropic-ai/claude-code

Configuring Git Bash for Native Windows

On native Windows, Claude Code attempts to run commands using Git Bash. If Git for Windows is installed in a non-standard directory, specify its location in %USERPROFILE%\.claude\settings.json:

{
  "env": {
    "CLAUDE_CODE_GIT_BASH_PATH": "C:\\Program Files\\Git\\bin\\bash.exe"
  }
}

Without Git for Windows, Claude Code directs commands to the PowerShell tool. While PowerShell handles most tasks, Git Bash offers superior compatibility with cross-platform build scripts.

Method 2: Installing Claude Code in WSL 2

If your codebase targets Linux servers or requires process sandboxing, installing Claude Code inside WSL 2 provides the cleanest setup. Open your WSL terminal (e.g. Ubuntu 24.04) and run:

curl -fsSL https://claude.ai/install.sh | bash

Verify the installation:

claude --version

For best disk I/O performance in WSL 2, keep your repositories inside the Linux virtual filesystem (e.g., /home/username/projects/) rather than accessing Windows mounts under /mnt/c/.

Authenticating and Starting Your First Session

Navigate to your project directory and start the CLI:

cd C:\Users\Username\Projects\my-app
claude

On initial launch, Claude Code prompts you to authenticate:

  1. Browser Login (OAuth): The CLI opens your web browser to authorize your Claude subscription or Console profile. The session captures the token automatically upon approval.
  2. API Key Login: For headless workstations, set the environment variable in PowerShell prior to launching:
    $env:ANTHROPIC_API_KEY="sk-ant-api03-your-secret-api-key"
    claude

Once authenticated, you can converse interactively or execute single-shot commands:

claude "Review auth.ts and add unit tests for token expiration"

To keep your setup updated, see our guide on how to update Claude Code across native, npm, and package manager channels. To route queries to alternative models or local endpoints, you can pair the CLI with a Claude Code Router.

Verifying Installation Health with Claude Doctor

Anthropic includes a diagnostic tool to verify environment and network configuration. Run:

claude doctor

This command inspects your version, verifies API connectivity, checks CLAUDE.md configuration files, and validates the auto-updater. If an issue is detected, claude doctor provides targeted suggestions.

Troubleshooting Common Errors on Windows

1. “claude is not recognized as an internal or external command”

This error occurs when the Windows Path variable lacks the binary directory.

Fix: Add the user local binary path using PowerShell:

[Environment]::SetEnvironmentVariable(
    "Path",
    $env:Path + ";$env:USERPROFILE\.local\bin",
    [EnvironmentVariableTarget]::User
)

Restart your terminal and run claude --version to verify.

2. ExecutionPolicy Errors in PowerShell

If running the install script fails with a script execution restriction, your policy is too strict.

Fix: Allow signed remote scripts for the current user:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

3. Syntax Errors: “The token ‘&&’ is not a valid statement separator”

This error occurs when running CMD commands inside PowerShell.

Fix: Check your shell prompt:

  • If the prompt starts with PS C:\>, use irm https://claude.ai/install.ps1 | iex.
  • If the prompt starts with C:\> without PS, use the CMD command.

4. Git Line Ending Inconsistencies (CRLF vs. LF)

Because Windows uses CRLF while Linux uses LF, Claude Code might show entire files as changed.

Fix: Configure Git to handle line endings transparently:

git config --global core.autocrlf true

Frequently Asked Questions

Can I use Claude Code on Windows without installing WSL?

Yes. Claude Code runs natively on Windows 10 and 11 via PowerShell, CMD, or Git Bash. WSL 2 is only needed if your project requires Linux process sandboxing or Linux-specific compilers.

Does Claude Code on Windows support local LLM runners?

Native Claude Code connects to Anthropic endpoints by default. To connect local models from Ollama or LM Studio, place a middleware proxy like Claude Code Router between the CLI and your local server.

How do I completely uninstall Claude Code from Windows?

To remove a native installation, delete the binary and config directories in PowerShell:

Remove-Item -Path "$env:USERPROFILE\.local\bin\claude.exe" -Force
Remove-Item -Path "$env:USERPROFILE\.local\share\claude" -Recurse -Force
Remove-Item -Path "$env:USERPROFILE\.claude" -Recurse -Force
Remove-Item -Path "$env:USERPROFILE\.claude.json" -Force

Summary

Setting up claude code windows environments requires just one terminal command. Whether you choose native PowerShell for direct Windows filesystem access or WSL 2 for sandboxed Linux execution, Claude Code provides an efficient terminal assistant for daily engineering. Add %USERPROFILE%\.local\bin to your Path, install Git for Windows for full shell tool compatibility, and use claude doctor to confirm your system health.