powershell-windows

Featured

PowerShell Windows patterns. Critical pitfalls, operator syntax, error handling.

AI & Automation 39,350 stars 6386 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# PowerShell Windows Patterns > Critical patterns and pitfalls for Windows PowerShell. --- ## 1. Operator Syntax Rules ### CRITICAL: Parentheses Required | ❌ Wrong | ✅ Correct | |----------|-----------| | `if (Test-Path "a" -or Test-Path "b")` | `if ((Test-Path "a") -or (Test-Path "b"))` | | `if (Get-Item $x -and $y -eq 5)` | `if ((Get-Item $x) -and ($y -eq 5))` | **Rule:** Each cmdlet call MUST be in parentheses when using logical operators. --- ## 2. Unicode/Emoji Restriction ### CRITICAL: No Unicode in Scripts | Purpose | ❌ Don't Use | ✅ Use | |---------|-------------|--------| | Success | ✅ ✓ | [OK] [+] | | Error | ❌ ✗ 🔴 | [!] [X] | | Warning | ⚠️ 🟡 | [*] [WARN] | | Info | ℹ️ 🔵 | [i] [INFO] | | Progress | ⏳ | [...] | **Rule:** Use ASCII characters only in PowerShell scripts. --- ## 3. Null Check Patterns ### Always Check Before Access | ❌ Wrong | ✅ Correct | |----------|-----------| | `$array.Count -gt 0` | `$array -and $array.Count -gt 0` | | `$text.Length` | `if ($text) { $text.Length }` | --- ## 4. String Interpolation ### Complex Expressions | ❌ Wrong | ✅ Correct | |----------|-----------| | `"Value: $($obj.prop.sub)"` | Store in variable first | **Pattern:** ``` $value = $obj.prop.sub Write-Output "Value: $value" ``` --- ## 5. Error Handling ### ErrorActionPreference | Value | Use | |-------|-----| | Stop | Development (fail fast) | | Continue | Production scripts | | SilentlyContinue | When errors expected | ### Try/Catch Pattern - Don't...

Details

Author
sickn33
Repository
sickn33/antigravity-awesome-skills
Created
4 months ago
Last Updated
today
Language
Python
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category