powershell

📁 g1joshi/agent-skills 📅 3 days ago
2
总安装量
2
周安装量
#62731
全站排名
安装命令
npx skills add https://github.com/g1joshi/agent-skills --skill powershell

Agent 安装分布

codex 2
mcpjam 1
claude-code 1
junie 1
zencoder 1

Skill 文档

PowerShell

A task-based command-line shell and scripting language built on .NET.

When to Use

  • Windows system administration
  • Azure management
  • Object-oriented scripting
  • Cross-platform automation (PowerShell Core)

Quick Start

$name = "World"
Write-Host "Hello, $name!"

$processes = Get-Process | Where-Object { $_.CPU -gt 10 }
foreach ($p in $processes) {
    Write-Output $p.Name
}

Core Concepts

Cmdlets

Lightweight commands used in the PowerShell environment (Verb-Noun structure).

  • Get-Process
  • New-Item
  • Set-Location

Objects

PowerShell pipes Objects, not text.

Get-Service | Select-Object -Property Name, Status

Pipeline

Passes objects from one cmdlet to the next.

Best Practices

Do:

  • Use the Verb-Noun naming convention for functions
  • Use Try/Catch for error handling
  • Use [CmdletBinding()] for advanced functions
  • Output objects, not text (Write-Output over Write-Host)

Don’t:

  • Parse text output like in Bash (use object properties)
  • Use aliases in scripts (readability)

References