CMD & PowerShell Scripting Pitfalls

•
2
•

Diagnoses and prevents Windows CMD and PowerShell scripting traps, encoding bugs, parsing quirks, and cross-shell execution errors.

The CMD & PowerShell Scripting Pitfalls skill equips Claude with definitive troubleshooting patterns and defense-in-depth practices for Windows shell scripting. It resolves complex cross-shell execution issues including nested quote escaping, code page and UTF-8 BOM mismatches between Windows PowerShell 5.1 and PowerShell 7+, delayed expansion pitfalls with exclamation marks, for-loop parentheses block parsing errors, and exit code propagation. Ideal for developers writing automation scripts, maintaining Windows CI/CD pipelines, or bridging batch files with modern PowerShell and Git Bash/MSYS2 environments.

Características Principales

012 GitHub stars
02Resolves multi-layer quoting and character escaping bugs between CMD and PowerShell
03Corrects delayed variable expansion and parentheses block parsing traps in batch loops
04Eliminates character encoding mismatches across console code pages, streams, and file I/O
05Standardizes exit codes, error handling boundaries, and execution policy management
06Prevents MSYS2/Git Bash POSIX path conversion conflicts with Windows native CLI tools

Casos de Uso

01Migrating legacy CMD scripts to clean, modern PowerShell while preserving exit code contracts
02Automating Windows system administration tasks without running into character encoding and path truncation traps
03Debugging fragile Windows batch scripts and embedded PowerShell commands in CI/CD build runners