
Powershell Shell Detection
If you're shipping scripts or automation that needs to run across PowerShell, Git Bash, and cmd on Windows, this gives you the detection logic and compatibility patterns to stop guessing. It covers the priority order for shell detection (PSModulePath first, then MSYSTEM), the path conversion gotchas in Git Bash that silently break things, and how to call PowerShell from bash and vice versa. The real value is in the specifics: when MSYS_NO_PATHCONV matters, why environment variable syntax breaks cross-shell, and which detection method actually works reliably. Use it when you're tired of scripts that work in your shell but fail in CI or on a teammate's machine.
- skills.sh installs
- 209
- GitHub stars
- 61
- last updated
- Aug 21, 2026
Install
$ npx -y skills add josiahsiegel/claude-plugin-marketplace --skill powershell-shell-detection --agent claude-codeInstalls into .claude/skills of the current project.
Files
PowerShell Shell Detection & Cross-Shell Compatibility
Critical guidance for distinguishing between PowerShell and Git Bash/MSYS2 shells on Windows, with shell-specific path handling and compatibility notes.
Shell Detection Priority (Windows)
When working on Windows, correctly identifying the shell environment is crucial for proper path handling and command execution.
Detection Order (Most Reliable First)
- process.env.PSModulePath (PowerShell specific)
- process.env.MSYSTEM (Git Bash/MinGW specific)
- process.env.WSL_DISTRO_NAME (WSL specific)
- uname -s output (Cross-shell, requires execution)
PowerShell Detection
Primary Indicators
PSModulePath (Most Reliable):
# PowerShell detection
if ($env:PSModulePath) {
Write-Host "Running in PowerShell"
# PSModulePath contains 3+ paths separated by semicolons
$env:PSModulePath -split ';'
}
# Check PowerShell version
$PSVersionTable.PSVersion
# Output: 7.5.4 (PowerShell 7) or 5.1.x (Windows PowerShell)
Sponsors
Details
- Repository
- github.com/josiahsiegel/claude-plugin-marketplace
- Categories
- Git & Pull Requests, Automation & Workflows, Marketing & SEO, CLI & Terminal
- First seen
- Jun 3, 2026
More from josiahsiegel/claude-plugin-marketplace
All 26- Tailwindcss Debugging207
- Tailwindcss Plugins202
- Windows Path Troubleshooting197
- Debugging Troubleshooting 2025196
- Ado Pipeline Best Practices180
- Parallel Processing Patterns180
- Docker 2025 Features178
- Tailwindcss Advanced Layouts8.2K
- Tailwindcss Animations2.4K
- Tailwindcss Mobile First2.1K
- Powershell Master1.1K
- Docker Best Practices944
- Git Master811
- Tailwindcss Advanced Design Systems657
- Docker Security Guide619
- Tailwindcss Responsive Darkmode478
- Bash Master462
- Context Master399
- Tailwindcss Fundamentals V4393
- Tailwindcss Accessibility299
- Tailwindcss Framework Integration296
- Sql Server 2025260
- Tailwindcss Advanced Components250
- Tailwindcss Performance237