Skip to content

[Bug] Environment variables from .claude/settings.json not injected into Bash on Windows #20112

Description

@mattmcde78

Description:
Environment variables defined in the env section of .claude/settings.json are not available when executing Bash
commands on Windows.

Steps to Reproduce:

  1. Create .claude/settings.json in your project with an env section:
    {
    "env": {
    "AZURE_DEVOPS_PROJECT": "MDaemon10"
    }
    }
  2. Ask Claude Code to check the environment variable value using Bash
  3. Run echo %AZURE_DEVOPS_PROJECT% (cmd) or echo $env:AZURE_DEVOPS_PROJECT (PowerShell)

Expected Behavior:
The command should output MDaemon10

Actual Behavior:
The command outputs the literal string %AZURE_DEVOPS_PROJECT% (indicating the variable is not set)

Environment:

  • OS: Windows (include your version, e.g., Windows 11)
  • Claude Code version: (run claude --version)
  • Shell: cmd.exe / PowerShell (whichever you use)

Additional Context:
The settings file is correctly formatted and readable by Claude Code (it can read the file contents), but the
environment variables are not being passed to the shell execution context.

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions