A single PowerShell script that installs the Claude Code CLI on a fresh 64-bit Windows 10/11 machine. It installs Node.js LTS if missing, installs the Claude CLI globally with npm, and ensures the claude command is available in new PowerShell sessions.
- Detects an existing Node.js installation (requires Node >= 18).
- Downloads and installs Node.js LTS from nodejs.org if needed.
- Installs
@anthropic-ai/claude-codeglobally with npm. - Adds
%APPDATA%\npmto the user PATH soclauderesolves.
- Windows 10 or 11 (64-bit)
- Admin PowerShell session
- Internet access to:
- Save the script as
install-claude-code.ps1. - Open PowerShell as Administrator.
- Run:
PowerShell -ExecutionPolicy Bypass -File "$env:USERPROFILE\Desktop\install-claude-code.ps1"- Open a new PowerShell window and run:
claude --versionIf prompted by the CLI, complete login or set your API key.
- Verifies the OS is 64-bit.
- Ensures TLS 1.2 for downloads.
- Checks for Node.js >= 18:
- If missing, it fetches the latest LTS MSI from
nodejs.organd installs it silently.
- If missing, it fetches the latest LTS MSI from
- Verifies
npmis available. - Adds
%APPDATA%\npmto the user PATH (if not already present). - Runs
npm install -g @anthropic-ai/claude-code. - Confirms that the
claudecommand is available.
- The Node.js installer places binaries in
C:\Program Files\nodejs. - The
claudecommand is installed into%APPDATA%\npm. - PATH changes apply to new shells. If
claudeis not found, open a new PowerShell. - Some npm messages are printed to stderr even on success; the script accounts for that.
- Close and reopen PowerShell to reload PATH.
- Verify Node is installed:
node -v.
- Make sure
%APPDATA%\npmis on your user PATH. - Open a new PowerShell session and try again.
- Verify you can reach
https://nodejs.organdhttps://registry.npmjs.org. - Check if a proxy or antivirus is blocking downloads.
- Re-run the script from an elevated PowerShell.
To remove Claude Code:
npm uninstall -g @anthropic-ai/claude-codeTo remove Node.js:
- Open Apps & Features and uninstall Node.js.
To remove PATH entry (optional):
- Remove
%APPDATA%\npmfrom your user PATH.
- The script downloads Node.js from the official site and installs it silently.
- The CLI is fetched from the public npm registry.
- Review the script before running in restricted environments.
Specify your license here (MIT/Apache-2.0/etc.).
Script: install-claude-code.ps1