How to Install Claude Code on Windows: Login, Directory Trust, and Troubleshooting

    A practical guide to installing Anthropic’s Claude Code CLI on Windows 10 and Windows 11, covering Node.js setup, account login, project-directory trust, read-only analysis, and a first end-to-end workflow.

    1. Scope and Audience

    This guide uses Claude Code, Anthropic’s command-line coding assistant, to explain installation, login, directory authorization, and everyday use on Windows 10 and Windows 11. Other similar tools may use different interfaces and commands, so check their official documentation as you read.

    Claude Code runs in a terminal. It can read the code in the current directory and, after you approve, modify files or run commands. Confirm the scope of every authorization.

    2. Before You Install

    Prepare the following:

    • A Windows computer with internet access
    • A working Claude account—either a subscription account or an Anthropic Console account (the difference is covered in Section 4)
    • A dedicated project directory for testing, such as D:\workspace\demo-project
    • Node.js 18 or later; the current LTS release is recommended

    If the computer belongs to a company or school, confirm that the network can reach Anthropic’s services and that security software is not blocking the terminal or npm.

    3. Install Node.js and Claude Code

    First, install the runtime.

    1. Open the official Node.js website and download the Windows LTS installer.
    2. Double-click the installer, keep the default components, and confirm that it adds Node.js to the system PATH.
    3. When installation finishes, close every open Command Prompt window and open a new one.
    4. Check the versions:
    1. node --version
    2. npm --version

    If both commands return a version number, the environment is ready.

    Next, install Claude Code:

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

    A normal user account is enough. Installation usually takes a few minutes. Do not run the same command again while it is still running, or files may be locked. When it finishes, verify the install:

    1. claude --version

    If the shell reports that claude is not recognized as an internal or external command, three causes are common: the terminal was opened before installation; npm’s global directory is not on PATH; or the Node.js version is too old. Run npm config get prefix to see the global directory, which is often %APPDATA%\npm. After confirming that directory is on PATH, reopen the terminal and try again.

    The native Windows build may also need the Bash environment provided by Git for Windows. If startup says bash cannot be found, install Git for Windows and reopen the terminal.

    4. First Launch and Account Login

    Start the tool from the project directory:

    1. cd /d D:\workspace\demo-project
    2. claude

    The first run walks through theme selection, login method, and a directory-trust prompt. The theme only affects appearance; choose whatever you prefer.

    Claude Code commonly offers two login methods:

    • Subscription account: a Claude account with an active plan such as Pro or Max, signed in through the browser. This suits personal, interactive development.
    • Console account: usage billed from API credit in the Anthropic Console. This suits teams or setups that need centralized usage control.

    Permissions, quotas, and billing are independent between the two. A subscription and an API key are not interchangeable. Confirm which service your account actually has before you choose.

    When signing in through the browser:

    • Confirm the browser address is on the official domain
    • Do not send verification codes, tokens, or keys to anyone else
    • On a shared computer, do not choose to stay signed in for a long time
    • Close pages you no longer need after authorization finishes

    After login, enter /status in the session to see the current account, working directory, and model. To switch accounts, enter /logout, then /login.

    5. Directory Trust: Authorize Only the Project Directory

    The first time you start in a directory, the tool asks whether to trust the files there. Check that the path is correct before you agree.

    Follow these rules:

    • Start the tool only inside the project directory—not on the desktop, in Downloads, in your home directory, or at the root of the C: drive
    • If the directory contains .env files, key files, customer data, financial spreadsheets, or scans of identity documents, move them out or add them to ignore rules first
    • If you approve trust in the wrong directory, leave the session immediately and revoke trust for that directory in the configuration. The exact location depends on the current version; follow the official documentation
    • Check the directory for unexpected file changes

    To open Command Prompt quickly in a folder, type cmd in File Explorer’s address bar and press Enter. After the window opens, confirm the path with cd before starting the tool.

    6. Basic Interaction: Start with Read-Only Analysis

    On a first look at a project, ask for read-only analysis instead of edits:

    1. Review the current project’s directory structure and explain how the main modules relate. Do not modify any files, and do not run delete or install commands.

    Normally, the tool lists the directory layout, entry files, and module relationships. If it starts trying to change files, press Esc or Ctrl+C to interrupt and reject the action.

    Once you understand the project, ask a specific question:

    1. Find the code responsible for user login. Explain the request flow, how errors are handled, and possible edge cases.

    When you do want code changes, limit the scope and state how to verify them:

    1. Modify only files under src/auth, and add validation for the login parameters. List the plan before editing. After the changes, run npm test and explain the reason for each change.

    A strong prompt usually includes four kinds of information:

    1. Goal: what problem to solve
    2. Scope: which files may be read or changed
    3. Constraints: which behavior must stay the same
    4. Verification: which tests or checks to run when finished

    A vague request such as “optimize this project” can change many files and become hard to review.

    7. One Complete Hands-On Loop

    Use the following flow as a template for a first session.

    1. Create the project directory. Skip this if it already exists:
    1. mkdir D:\workspace\demo-project
    1. Enter the directory and initialize version control so each change can be compared and reverted:
    1. cd /d D:\workspace\demo-project
    2. git init
    1. Start claude, finish login, and trust the directory.
    2. Ask for a read-only analysis and confirm that its understanding matches the project.
    3. Request a scoped change and read the plan it proposes.
    4. Approve the edits and review each file-change prompt.
    5. Run the project’s existing tests or build command. The expected result is that all tests pass.
      8.