Getting Started with PowerShell
PowerShell · Reference cheat sheet
Getting Started with PowerShell
PowerShell · Reference cheat sheet
📋 Overview
PowerShell is a cross-platform shell and scripting language from Microsoft. Commands are usually cmdlets named Verb-Noun (like Get-ChildItem). It works with .NET objects, not only text.
🔧 Core concepts
| Idea | Meaning |
|---|---|
| Cmdlet | Built-in command: Get-Process |
| Pipeline | Pass objects between commands with | |
| Object | Structured data with properties/methods |
| Profile | Startup script for customizations |
| Execution policy | Controls which scripts may run (Windows) |
Open Windows PowerShell, PowerShell 7+ (pwsh), or the integrated terminal in VS Code / Cursor.
💡 Examples
Version and help discovery:
$PSVersionTable.PSVersion
Get-Command Get-ChildItem
Get-Help Get-ChildItem -ExamplesList files (like ls):
Get-ChildItem
Get-ChildItem -Force
pwdHello in the shell:
Write-Output "Hello from PowerShell"
"Hello" | Write-HostSimple script (hello.ps1):
Write-Output "Hello, World!"pwsh ./hello.ps1⚠️ Pitfalls
- Execution policy may block scripts — see
Get-ExecutionPolicy; fix carefully, not by disabling security blindly. - Aliases like
ls/curlmay not match Linux behavior exactly. - Windows PowerShell 5.1 ≠ PowerShell 7 — prefer
pwshwhen possible. - Paths with spaces need quotes:
cd "C:\My Projects".