Home

Install Claude Code on Windows

Claude Code is an AI assistant that lives in your terminal and helps you write, debug, and understand code. This guide gets you running natively on Windows in just a few minutes. WSL2 is also available at the end as an optional, more advanced setup.

Key Concepts

What You’ll Need

Git for Windows is recommended but optional. It adds Git Bash, the shell Claude Code uses to run commands. If you skip this step, Claude Code falls back to PowerShell instead — so you can move straight to Step 2 and install Git later if you prefer.

That’s it — Claude Code will detect Git Bash automatically when it starts.

Step 2: Install Claude Code

Step 3: Connect to Your Anthropic Account

Option A. Use your Claude Pro or Max subscription

The API-based options below stay in PowerShell and use the setx command, which saves a setting permanently. After running setx, close and reopen PowerShell so the change takes effect, then start claude.

Option B. Use Anthropic API key

If you have an Anthropic API key instead of a Claude subscription:

Option C. Use OpenRouter API (starts for free!)

OpenRouter is a unified API gateway that provides access to 500+ large language models through a single API key. This can be an economical way to use Claude Code, as you pay only for usage and can choose from models at various price points.

Notes:

Option D. Use Anthropic API via Azure Foundry

In PowerShell, paste this code to define the environment variables:

# Enable Microsoft Foundry integration
setx CLAUDE_CODE_USE_FOUNDRY 1
# Azure resource name
setx ANTHROPIC_FOUNDRY_RESOURCE "xxxx-eastus2"
# Set models to your resource's deployment names
setx ANTHROPIC_DEFAULT_OPUS_MODEL "claude-opus-4-5"
setx ANTHROPIC_DEFAULT_SONNET_MODEL "claude-sonnet-4-5"
setx ANTHROPIC_DEFAULT_HAIKU_MODEL "claude-haiku-4-5"
setx ANTHROPIC_FOUNDRY_API_KEY "your_api_key"

Note: Replace xxxx-eastus2 with your Foundry Resource name (do not use the entire base URL). Replace your_api_key with your complete API key from your Azure portal.

Then close and reopen PowerShell, and start Claude Code:

claude

You should now be able to use Claude Code with Azure-deployed Claude models.

Step 4: Test Claude Code

You’re all set! Type claude in PowerShell and ask a general question such as “Explain quantum computing.”

Step 5: Access Your Projects

Note: Claude operates inside a project folder. It saves settings in that folder. It’s Claude’s workspace.

Step 6: (Optional) Install WSL2 for the Full Linux Experience

The native setup above is almost all that most people need. But Claude Code performs better under Linux. WSL2 runs a real Linux system inside Windows and adds Bash tool sandboxing (a security feature) plus better compatibility with Linux toolchains. It takes longer to set up and requires a restart, so only do this if you want the full Linux experience.

a) Check virtualization and install WSL

First, check if virtualization is enabled:

If it says “Disabled”: You need to enable virtualization in your computer’s BIOS settings:

Now install WSL:

Note: wsl --install requires Windows 10 version 2004 or higher, or Windows 11. If the command is not recognized, your Windows version may be too old.

b) Set up Ubuntu

After your computer restarts, a terminal window with “Ubuntu” in the title should open automatically within 2-5 minutes. If it doesn’t, click the Windows Start button, type Ubuntu, and click the Ubuntu app (orange circle icon).

Important: Remember this username and password — you’ll need them later.

c) Install Claude Code in WSL

Next Steps

Troubleshooting

First step: Run Claude Doctor

If something isn’t working, try running this command first:

claude doctor

This built-in diagnostic tool checks your installation and reports common issues.

Claude command not found (native Windows)

“Please enable the Virtual Machine Platform Windows feature and ensure virtualization is enabled in the BIOS”

This error means virtualization is not enabled:

“wsl –install” doesn’t work

Ubuntu window doesn’t open after restart

Need Help?


Created by Steven Ge on December 11, 2025. Updated June 2026.