Adds "Bash (Windows Terminal)" to the Windows right-click context menu. Right-click any folder → open Git Bash in Windows Terminal, pre-positioned in that directory.
Claude Code runs best in a bash environment on Windows. While PowerShell and CMD can work, bash provides:
- Native Unix toolchain —
grep,find,sed, and other tools behave exactly as Claude Code expects - Consistent path handling —
/c/Users/...instead of backslash/forward-slash confusion - Better script execution — Claude Code frequently generates and runs bash snippets
- Cross-platform parity — same shell experience as macOS/Linux teammates
This tool eliminates the friction of manually cd-ing from your home directory. Right-click where you want to work → you're there in bash, ready to run claude.
- Git for Windows — provides
bash.exe(download) - Windows Terminal — pre-installed on Windows 11, or
winget install Microsoft.WindowsTerminal
powershell -ExecutionPolicy Bypass -File install.ps1No admin rights required. The installer:
- Auto-detects
bash.exeandwt.exeon your system - Generates a launcher script in
~/bin/ - Writes registry entries under
HKCU\Software\Classes
Right-click in any folder (or empty space inside a folder) → Bash (Windows Terminal).
Then simply type claude to start your Claude Code session in that directory.
powershell -ExecutionPolicy Bypass -File ~/bin/uninstall-bash-wt-menu.ps1Or re-run the installer and copy the uninstall command from its output.
Right-click → Registry → PowerShell launcher → wt.exe -d <dir> -- bash.exe
The launcher handles two Windows command-line edge cases:
| Problem | Fix |
|---|---|
Start-Process -ArgumentList doesn't quote paths with spaces (PowerShell 5.1 bug) |
Manual ProcessStartInfo.Arguments construction |
Drive root paths like D:\" break argument parsing (backslash escapes closing quote) |
Doubles trailing backslash: D:\\ |
Windows Terminal version upgrades change wt.exe path |
Searches all drives at runtime |
| File | Purpose |
|---|---|
install.ps1 |
One-shot installer — the only file you need |
The installer generates ~/bin/open-bash-wt.ps1 (launcher) and ~/bin/uninstall-bash-wt-menu.ps1 at install time.
Claude Code 在 Windows 上最适合在 bash 环境 中运行。PowerShell 和 CMD 虽然也能用,但 bash 提供:
- 原生 Unix 工具链 —
grep、find、sed等工具的行为与 Claude Code 预期完全一致 - 路径处理一致 — 使用
/c/Users/...格式,避免反斜杠与正斜杠的混淆 - 更好的脚本兼容 — Claude Code 经常生成并执行 bash 代码片段
- 跨平台统一 — 与 macOS/Linux 团队成员使用相同的 shell 体验
这个工具省去了手动 cd 到目标目录的麻烦。在任意文件夹右键 → 直接进入 Windows Terminal 中的 bash 环境,立即就能运行 claude。
- Git for Windows — 提供
bash.exe(下载) - Windows Terminal — Windows 11 预装,或
winget install Microsoft.WindowsTerminal
powershell -ExecutionPolicy Bypass -File install.ps1无需管理员权限。安装器会:
- 自动检测系统中的
bash.exe和wt.exe - 在
~/bin/生成启动脚本 - 在
HKCU\Software\Classes写入注册表项
在任意文件夹(或文件夹内空白处)右键 → Bash (Windows Terminal)。
然后输入 claude 即可在该目录启动 Claude Code 会话。
powershell -ExecutionPolicy Bypass -File ~/bin/uninstall-bash-wt-menu.ps1右键菜单 → 注册表 → PowerShell 启动器 → wt.exe -d <目录> -- bash.exe
启动器处理了两个 Windows 命令行的边界问题:
| 问题 | 解决方案 |
|---|---|
PowerShell 5.1 的 Start-Process -ArgumentList 不给含空格的参数加引号 |
手动构造 ProcessStartInfo.Arguments 字符串 |
盘符根目录 D:\" 的 \ 会把引号转义,破坏参数边界 |
运行时检测并加倍末尾反斜杠:D:\\ |
Windows Terminal 升级会改变 wt.exe 路径 |
每次运行时动态搜索所有驱动器 |
| 文件 | 用途 |
|---|---|
install.ps1 |
一键安装脚本(唯一需要的文件) |
安装器在运行时生成 ~/bin/open-bash-wt.ps1(启动器)和 ~/bin/uninstall-bash-wt-menu.ps1(卸载脚本)。
MIT
