Developer Tools

How to Install and Configure Claude Code CLI on Windows PowerShell

Claude Code is a command-line tool by Anthropic that brings Claude directly into your terminal. You can use it for code review, debugging, generating…

How to Install and Configure Claude Code CLI on Windows PowerShell
Share:

How to Install and Configure Claude Code CLI on Windows PowerShell

4 min read
10.2K views

Claude Code is a command-line tool by Anthropic that brings Claude directly into your terminal. You can use it for code review, debugging, generating scripts, and working with files — all without leaving the command line. This guide walks you through installing and configuring Claude Code CLI on Windows PowerShell.

If you’d rather run Claude Code inside WSL, see How to Install Claude Code CLI on WSL2 Ubuntu instead.

Advertisement

Prerequisites

  • Windows 10 version 1809 or later, Windows 11, or Windows Server 2019 or later
  • PowerShell (comes with Windows)
  • Git for Windows (optional but recommended). It provides Git Bash, which Claude Code uses to run shell commands. Without it, Claude Code runs commands through PowerShell instead. The native installer below does not need Node.js.
  • A paid Claude plan (Pro, Max, Ultra, Team, or Enterprise) or an Anthropic Console account with API billing. The free Claude.ai plan does not include Claude Code.

Install Claude Code CLI

Step 1: Open PowerShell

Press Win + X and select Terminal (or search for PowerShell in the Start menu).

Step 2: Run the installer

irm https://claude.ai/install.ps1 | iex
  • irm — short for Invoke-RestMethod, downloads the install script from Anthropic’s site.
  • iex — short for Invoke-Expression, executes the downloaded script.

If you get 'irm' is not recognized as an internal or external command, you’re in Command Prompt, not PowerShell. Either switch to PowerShell, or use the CMD version of the installer:

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

When it finishes, you’ll see something like:

Advertisement
Claude Code successfully installed!
Location: C:\Users\yourname\.local\bin\claude.exe

Step 3: Add Claude to your PATH

The installer does not change your PATH itself. If it printed a note that .local\bin is not in your PATH, add it for your user account:

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

$env:USERPROFILE expands to your own user folder, so there’s nothing to replace. Then close and reopen PowerShell so the new PATH takes effect.

Step 4: Reload PATH without restarting (optional)

If you don’t want to restart PowerShell, reload the environment variables in the current session:

$env:Path = [Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [Environment]::GetEnvironmentVariable("Path", "User")

Step 5: Verify the installation

claude --version

If this prints a version number, you’re good. You can also run claude --help to see all available flags.

Authenticate Claude Code

Run claude for the first time to start the authentication flow:

claude

The CLI will show a welcome screen and present three login options:

  1. Claude account (subscription) — uses your Claude Pro, Max, Ultra, Team, or Enterprise plan. Best for individual use.
  2. Anthropic Console (API billing) — uses API credits from your Anthropic account. Better for heavy usage or automation.
  3. Third-party platform — connects through AWS Bedrock, Google Vertex AI, or other providers.

Pick one and follow the browser prompt to log in. Once authenticated, you’re back in the terminal and ready to go.

Basic Usage

Claude Code is context-aware — it reads files in your current working directory. Here are a few practical examples.

Start an interactive session in your project folder (to connect Claude Code to external tools, see How to Configure MCP Servers in VS Code, Claude Desktop, and Claude Code on WSL):

cd C:\Projects\my-app
claude

Ask a one-off question with -p (print mode — no interactive session):

claude -p "review my terraform code and suggest improvements"

Pipe output from another command:

Get-Content error.log | claude -p "explain this error and suggest a fix"

Generate a file directly:

claude -p "create a least privilege IAM policy for Lambda accessing S3. Output only the JSON, no explanation" | Out-File -Encoding utf8 policy.json

Use Out-File -Encoding utf8 instead of >: in Windows PowerShell 5.1, > writes UTF-16, which many tools (including the AWS CLI) won’t read as JSON. Asking for “only the JSON” stops Claude from wrapping the policy in explanation text. Open the file and check it before using it.

Update Claude Code CLI

Installs from the native installer update themselves automatically in the background. To update right away instead of waiting for the next check:

claude update

If you installed with WinGet instead, it does not auto-update. Run winget upgrade Anthropic.ClaudeCode from time to time.

Check the current version with claude --version to confirm the update.

Security Tips

  • Don’t paste real credentials, API keys, or secrets into prompts. Use placeholders or describe what you need instead.
  • Review any generated IAM policies or infrastructure code before applying them.
  • If you’re using API billing, keep an eye on your token usage in the Anthropic Console.

Conclusion

That covers installing and setting up Claude Code CLI on Windows PowerShell. The install takes a few minutes, and from there you can use Claude directly from your terminal for code reviews, debugging, and script generation.

If you also work in WSL, check out How to Install Claude Code CLI on WSL2 Ubuntu. And if you’re setting up other CLI tools in PowerShell, How to Configure AWS SSO CLI Access for Windows PowerShell might also be useful. Ready to share your own commands with a team? See How to Build and Deploy a Custom Claude Code Plugin with Skills, and for a full new-machine setup, How to Set Up a DevOps Onboarding Environment on Windows with WSL2 and AI Tools.

Recommended for Linux builders

Contabo VPS hosting for Linux projects

Run Linux servers, automation tools, and self-hosted apps on a Contabo VPS with generous resources and predictable pricing.

Our customers sayExcellent4.6 out of 5 based on 11,008 reviews Trustpilot

Some links are affiliate links. This may earn LinuxBeast a commission at no extra cost to you.

Privacy settings

Choose which privacy controls to open.

Opening these controls does not change your saved choices.