powershell-shell-detection

Distinguish PowerShell from Git Bash/MSYS2 shells on Windows.

51|10|Updated Oct 22, 2025
One-click install
npx skills add https://github.com/JosiahSiegel/claude-plugin-marketplace --skill powershell-shell-detection
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: powershell-shell-detection
Source: https://github.com/JosiahSiegel/claude-plugin-marketplace/tree/main/plugins/powershell-master/skills/powershell-shell-detection
Command: npx skills add https://github.com/JosiahSiegel/claude-plugin-marketplace --skill powershell-shell-detection

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you reliably distinguish between PowerShell and Git Bash/MSYS2 shells on Windows, preventing common path handling and command execution errors.

Core Features & Use Cases

  • Shell Detection: Accurately identify the current shell environment (PowerShell, Git Bash, WSL).
  • Path Handling Guidance: Understand and implement correct path syntax for each shell.
  • Cross-Shell Compatibility: Learn strategies to write scripts that work across different Windows shells.
  • Use Case: When running a script on Windows that needs to access files, this Skill ensures your script correctly interprets paths like C:\Users\Name in PowerShell and /c/Users/Name in Git Bash, avoiding errors.

Quick Start

Use the powershell-shell-detection skill to determine if the current environment is PowerShell or Git Bash.

Frequently Asked Questions about powershell-shell-detection

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I detect if a script is running in PowerShell or Git Bash on Windows?

Shell detection on Windows involves checking specific environment variables and command formats that differ between PowerShell and Git Bash. This Skill provides guidance on accurately identifying the current shell to prevent path handling errors.

Why does my cross-shell script fail with path errors on Windows?

Cross-shell script path errors occur because PowerShell uses backslash paths like C:\Users\Name while Git Bash uses forward-slash POSIX paths like /c/Users/Name. This Skill guides you in implementing correct path syntax for each shell.

What is the best way to handle Windows path separators across different shells?

Handling Windows path separators across shells requires understanding that PowerShell uses backslashes and Git Bash uses forward slashes. This Skill offers best practices for shell-aware script design and troubleshooting path compatibility.

Can I write a single script that works in both PowerShell and Git Bash?

Writing a single script for both PowerShell and Git Bash is possible by implementing shell detection and conditional path handling logic. This Skill details strategies for cross-shell compatibility to ensure reliable script execution.

How do I convert Windows file paths for Git Bash and MSYS2 compatibility?

Converting Windows file paths for Git Bash and MSYS2 compatibility requires translating backslash Windows paths to forward-slash POSIX style. This Skill provides practical examples for correct path interpretation across shell environments.