What actually cuts a coding agent's token use: 19 measured studies
We measured what lowers Codex token usage over whole tasks. Prompts and retrieval barely helped; a structured workflow cut 87.56% on suitable migrations.
Read the articleThe official installer takes one line. What usually goes wrong comes after: a PATH that was not updated, the wrong shell, Git Bash that cannot be found. This guide covers the install and every common fix.
irm https://claude.ai/install.ps1 | iex. No administrator rights needed.claude --version and then claude doctor.Claude Code used to be awkward on Windows. You needed Node.js, then Git Bash, and for a while WSL was the only way that worked well. That has changed. Anthropic now ships a native Windows installer, Claude Code can run its commands through PowerShell, and WSL is optional.
This guide follows Anthropic's own setup and troubleshooting pages as they stood on 4 October 2026. Every command was copied from them, character for character.
We make AigoPilot, a Claude Code GUI for Windows, so we set up Claude Code on Windows PCs more often than most people. The errors below are the ones Anthropic's own troubleshooting page covers, with the fixes it gives. AigoPilot can also run this installer for you, but everything here works without it.
Not sure which version of Windows you have? Press Win + R, type winver and press Enter.
There are five ways to install it. Use the first unless you have a reason not to.
In PowerShell:
irm https://claude.ai/install.ps1 | iexIn CMD:
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmdThe native install updates itself in the background, and it puts claude.exe in %USERPROFILE%\.local\bin. If you prefer the slower, more tested release channel, the installer takes stable as an argument:
& ([scriptblock]::Create((irm https://claude.ai/install.ps1))) stablewinget install Anthropic.ClaudeCodeA WinGet install does not update itself. Run winget upgrade Anthropic.ClaudeCode from time to time, or set the environment variable CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE=1.
Still supported, and useful if you manage tools through Node. It needs Node.js 22 or later.
npm install -g @anthropic-ai/claude-codeTo upgrade, run npm install -g @anthropic-ai/claude-code@latest. Anthropic advises against npm update -g.
Open your Linux distribution and install the Linux build inside it:
curl -fsSL https://claude.ai/install.sh | bashChoose WSL 2 if you want Claude Code's sandbox, which isolates the commands the agent runs. The sandbox works under WSL 2. It does not work under WSL 1 or on native Windows.
Git for Windows is optional now. Without it, Claude Code runs shell commands through its PowerShell tool. With it installed, Claude Code uses Git Bash for its Bash tool.
You probably want it anyway. Claude Code is much more useful in a git repository, where it can show you diffs, make commits and work in separate worktrees, and the Claude desktop app needs Git for worktree sessions. Install it from git-scm.com or with winget install Git.Git, then open a new terminal.
Go to a project folder and start Claude Code:
cd C:\code\my-project
claudeA browser window opens and asks you to sign in with your Claude account. If the browser does not open, press c to copy the sign-in link and paste it into a browser yourself. If an ANTHROPIC_API_KEY environment variable is set, Claude Code asks you once whether to use that key instead.
claude --version
claude doctorclaude --version prints something like 2.1.211 (Claude Code). claude doctor checks the install and your settings without starting a session. Inside a session, /doctor runs the same check and offers fixes, and /status shows which account you are signed in with.
The install worked, but your terminal does not know where claude.exe is. First, close the terminal and open a new one; a terminal that was open during the install still has the old PATH. If it still fails, check whether the folder is on your PATH:
$env:PATH -split ';' | Select-String '\.local\\bin'If nothing comes back, add it to your user PATH and open a new terminal:
$currentPath = [Environment]::GetEnvironmentVariable('PATH', 'User')
[Environment]::SetEnvironmentVariable('PATH', "$currentPath;$env:USERPROFILE\.local\bin", 'User')You pasted the command into the wrong shell. irm is PowerShell, so seeing it rejected means you are in CMD. The && error means you are in PowerShell running the CMD line. And "A parameter cannot be found that matches parameter name 'fsSL'" means you ran the Linux command in PowerShell. Check the title of your terminal tab and use the matching command from step 1.
Claude Code found neither shell. It looks for Git in C:\Program Files\Git, then C:\Program Files (x86)\Git, then whatever git is on your PATH. If Git is somewhere else, find it with where.exe git and tell Claude Code where its bash.exe is, in %USERPROFILE%\.claude\settings.json:
{
"env": {
"CLAUDE_CODE_GIT_BASH_PATH": "C:\\Program Files\\Git\\bin\\bash.exe"
}
}Point it at bash.exe, not at git-bash.exe; the second one is not accepted. If the problem is PowerShell, add C:\Windows\System32\WindowsPowerShell\v1.0\ to your PATH.
This one affects npm installs, not the native installer. PowerShell refuses to run npm's .ps1 wrapper. Allow signed and local scripts for your own user:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserIf you would rather not change the policy, call claude.cmd instead of claude, or switch to the native installer.
An update can be interrupted halfway, leaving the old file renamed. Put the newest copy back:
Get-ChildItem "$env:USERPROFILE\.local\bin\claude.exe.old.*" | Sort-Object Name | Select-Object -Last 1 | Rename-Item -NewName claude.exeUsually antivirus holding the download. Clear the download folder and run the installer again:
Remove-Item -Recurse -Force "$env:USERPROFILE\.claude\downloads"On a work PC with endpoint protection or AppLocker, your IT team may need to allow claude.exe, cmd.exe and bash.exe.
An older Claude desktop app can put its own Claude.exe ahead of the CLI on your PATH. Update the desktop app, and run where.exe claude to see every claude Windows can find. The same command shows leftovers if you installed twice, say once with npm and once with the native installer.
You opened "Windows PowerShell (x86)" by mistake. Close it and open the normal Windows PowerShell or Windows Terminal. [Environment]::Is64BitOperatingSystem should print True.
/logout, restart Claude Code and sign in again.claude auth login.ANTHROPIC_API_KEY is set. Remove it with Remove-Item Env:ANTHROPIC_API_KEY, and from your user environment variables if you set it there.403 Request not allowed: check that your plan includes Claude Code, or that your Console role allows it.Set the proxy before running the installer, then test that the download server is reachable:
$env:HTTP_PROXY = 'http://proxy.example.com:8080'
$env:HTTPS_PROXY = 'http://proxy.example.com:8080'
curl.exe -sI https://downloads.claude.ai/claude-code-releases/latestIf you see TLS errors on an older Windows 10, run [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 first.
If you installed with npm inside WSL and see exec: node: not found or a platform error, WSL is running the Windows npm from /mnt/c/. Check with which npm and which node, install Node inside Linux (nvm works well), and if needed run npm config set os linux before installing again with --force. Simpler still: use the Linux native installer from step 1.
| What | Where |
|---|---|
| The program | %USERPROFILE%\.local\bin\claude.exe (native install) |
| Your settings | %USERPROFILE%\.claude\settings.json |
| Your sign-in | %USERPROFILE%\.claude\.credentials.json |
| Instructions for every project | %USERPROFILE%\.claude\CLAUDE.md |
| Instructions for one project | CLAUDE.md or .claude\CLAUDE.md in the project |
| Project settings | .claude\settings.json, and .claude\settings.local.json for your own overrides |
Treat .credentials.json like a password. Do not copy it into a project folder or a backup you share.
The first session is easy to follow. By the third, in a second project, the hard part is no longer installing anything. It is noticing that one session has been waiting for your permission since lunch. Windows Terminal will not tell you on its own; our guide to Claude Code notifications on Windows shows how to fix that. And if you are choosing between agents, see Codex vs Claude Code.
Yes. Claude Code runs natively on Windows 10 version 1809 or later and on Windows Server 2019 or later. WSL is optional; you need it only if you want Claude Code's sandbox, which does not run on native Windows.
No, not any more. Without Git for Windows, Claude Code runs shell commands through PowerShell. With it installed, Claude Code uses Git Bash for its Bash tool.
The folder the installer uses, %USERPROFILE%\.local\bin, is not on your PATH yet, or the terminal was opened before the install. Open a new terminal first. If that does not help, add the folder to your user PATH.
No. Claude Code needs a Pro, Max, Team or Enterprise plan, or a Console account billed by API usage. The free claude.ai plan does not include it.
We measured what lowers Codex token usage over whole tasks. Prompts and retrieval barely helped; a structured workflow cut 87.56% on suitable migrations.
Read the articleOpenAI Codex and Anthropic's Claude Code compared on Windows support, sandboxing, models, plans, limits and daily use. And why many people end up running both.
Read the articleClaude Code and Cursor compared on how they work, Windows support, models, pricing and usage limits, and how to use them together in the same project.
Read the article