[BUG] Windows: stray file named "Set-Alias" in PATH triggers OS "choose an app" dialog when running claude

Status Open
Reported on v2.1.220
Maintainer reply None cached
Activity 0 comments · opened Jul 26, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

On Windows, running claude (both the CLI in a terminal and the VS Code extension panel) triggers Windows' "How do you want to open this file?" dialog for a file named "Set-Alias".

Root cause found via Process Monitor: this had nothing to do with Claude Code's own logic. There was a stray file literally named Set-Alias (no extension) sitting in C:\Windows\System32, dated 2025-03-17. When claude/powershell.exe resolves a command by scanning PATH directories, it finds this file in System32 and Windows' shell tries to open it, since it's not a recognized executable format.

This is arguably not a Claude Code bug per se, but Claude Code (and PowerShell command resolution in general) should probably handle non-executable files matching a command name more gracefully instead of triggering an OS-level ShellExecute prompt.

What Should Happen?

Running claude should start the CLI/extension normally without any OS-level file-open dialog appearing, regardless of what unrelated files happen to exist in PATH directories.

Error Messages/Logs

Process Monitor capture showed powershell.exe repeatedly resolving "Set-Alias" as a command:

QueryDirectory "C:\Windows\System32\Set-Alias.*" -> SUCCESS (file found: Set-Alias)
CreateFile "C:\Windows\System32\Set-Alias" -> SUCCESS (Read Attributes / Open Reparse Point)
QueryBasicInformationFile "C:\Windows\System32\Set-Alias" -> CreationTime: 2025-03-17 09:27:23

The file had no extension and was not a valid executable, causing Windows to fall back to a "choose an app to open this file" dialog.

Steps to Reproduce

  1. On Windows, have (or accidentally create) a file with no extension named Set-Alias inside C:\Windows\System32
  2. Open a terminal or the Claude Code VS Code extension panel
  3. Run claude (CLI) or open the Claude Code chat panel in VS Code
  4. Windows shows a "How do you want to open this file?" dialog for 'Set-Alias', listing apps like Adobe Acrobat, Notepad, Microsoft Edge, etc.
  5. This happens both from a standalone terminal (cmd/PowerShell) and from the VS Code extension panel, independent of terminal shell integration settings, PowerShell version (reproduced on both Windows PowerShell 5.1 and PowerShell 7.6.4), or other installed extensions

Workaround: deleting the stray C:\Windows\System32\Set-Alias file resolves the issue immediately.

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.220

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

Debugging steps that led to root cause:

  • Ruled out VS Code shell integration settings, PowerShell version (5.1 vs 7.6.4), Python environment conflicts, other extensions (GitHub Copilot, Git), and npm CLI shims — none of these were the cause.
  • Confirmed reproducible with all other VS Code extensions disabled, and independently from a standalone terminal outside VS Code entirely.
  • claude doctor reported "No installation issues found."
  • Process Monitor capture pinpointed the exact file lookup, confirming the OS dialog was triggered by command-name resolution finding C:\Windows\System32\Set-Alias on disk, not by Claude Code executing the PowerShell Set-Alias cmdlet.

Filing this mainly so others hitting the same confusing symptom can find the fix quickly: check for and delete any stray file named exactly after a PowerShell cmdlet (e.g. Set-Alias) inside C:\Windows\System32.

View original on GitHub ↗