CLAUDE_CODE_USE_POWERSHELL_TOOL
Updated by Alex Sorokoletov
CLAUDE_CODE_USE_POWERSHELL_TOOL turns the PowerShell tool on or off, so Claude can run PowerShell commands natively instead of through Git Bash. Default: on for Windows without Git Bash; on for claude.ai and Console accounts on Windows with Git Bash; off elsewhere. Values: 1, true, yes or on turns it on; 0, false, no or off turns it off (case-insensitive); on macOS, Linux and WSL only an on value enables it. Added between v2.1.79 and v2.1.83 and still present in v2.1.332. It is listed in the official reference.
| Status | Present in v2.1.332 |
|---|---|
| Added | Added between v2.1.79 and v2.1.83 |
| Default | on for Windows without Git Bash; on for claude.ai and Console accounts on Windows with Git Bash; off elsewhere |
| Values | 1, true, yes or on turns it on; 0, false, no or off turns it off (case-insensitive); on macOS, Linux and WSL only an on value enables it |
| Category | Shell and tools |
| Official docs | Listed |
| Checked against | v2.1.330 |
How to set it
For one session, export it in the shell that starts Claude Code:
export CLAUDE_CODE_USE_POWERSHELL_TOOL=1
claude1 turns the tool on in macOS or Linux sessions that have pwsh on PATH.
To apply it to every session, add it to the env object of a settings file:
// ~/.claude/settings.json
{
"env": {
"CLAUDE_CODE_USE_POWERSHELL_TOOL": "1"
}
}Known issues
- On Windows without Git Bash, 0 leaves no shell tool, and Claude Code exits at startup with 'Claude Code on Windows requires a shell tool'. Source: docs: tools reference.
- On Windows with Git Bash, a server-side rollout turned the tool on without notice and told the model the shell was PowerShell, which caused wrong-syntax retries in bash-based setups. Set 0 to keep Bash only. Source: issue #64253.
- The variable controls the tool Claude calls, not the shell for ! commands. In the Desktop app on Windows, ! commands still open PowerShell with 0 set. Source: issue #93662.
Release notes that mention it
- Claude Code v2.1.114 — Native Binary Launcher, /fewer-permission-prompts, and 20 New Environment Variables
- Claude Code v2.1.85 — 6 New Environment Variables: MCP Server Config and a 7 MB Diet
- Claude Code v2.1.84 — 6 New Environment Variables: Idle Management and Stream Resilience
- Claude Code v2.1.81 — 1 New Environment Variable: The --bare Flag and a Bug Fix Marathon
Related variables
CLAUDE_CODE_EMIT_TOOL_USE_SUMMARIES: Emit tool use summary events.CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY: Max concurrent tool executions; default 10.CLAUDE_CODE_TOOL_USE_IDCLAUDE_SDK_CAN_USE_TOOL_SHADOWEDCLAUDE_CODE_DISABLE_ADVISOR_TOOL: Disables what appears to be an internal advisory tool.CLAUDE_CODE_DISABLE_DEFERRED_TOOL_RESUME: Added in 2.1.328.CLAUDE_CODE_DISABLE_POWERSHELL_CMD_RM_DENYCLAUDE_CODE_DISABLE_POWERSHELL_LIBRARY_LOAD_GUARD: Turns off a guard in the PowerShell 7 parse that Claude Code runs to check a command against your permission rules.
Frequently asked questions
What does CLAUDE_CODE_USE_POWERSHELL_TOOL do?
Turns the PowerShell tool on or off, so Claude can run PowerShell commands natively instead of through Git Bash.
What is the default value of CLAUDE_CODE_USE_POWERSHELL_TOOL?
On for Windows without Git Bash; on for claude.ai and Console accounts on Windows with Git Bash; off elsewhere.
What values does CLAUDE_CODE_USE_POWERSHELL_TOOL accept?
1, true, yes or on turns it on; 0, false, no or off turns it off (case-insensitive); on macOS, Linux and WSL only an on value enables it.
Which Claude Code version has CLAUDE_CODE_USE_POWERSHELL_TOOL?
Added between v2.1.79 and v2.1.83 and still present in v2.1.332.
How do I set CLAUDE_CODE_USE_POWERSHELL_TOOL?
Export it before starting Claude Code (export CLAUDE_CODE_USE_POWERSHELL_TOOL=1), or add it to the "env" object in ~/.claude/settings.json to apply it to every session. 1 turns the tool on in macOS or Linux sessions that have pwsh on PATH.
All variables, searchable: Claude Code environment variables.