Code Reference

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

IdeaMeaning
CmdletBuilt-in command: Get-Process
PipelinePass objects between commands with |
ObjectStructured data with properties/methods
ProfileStartup script for customizations
Execution policyControls 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 -Examples

List files (like ls):

Get-ChildItem
Get-ChildItem -Force
pwd

Hello in the shell:

Write-Output "Hello from PowerShell"
"Hello" | Write-Host

Simple 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 / curl may not match Linux behavior exactly.
  • Windows PowerShell 5.1 ≠ PowerShell 7 — prefer pwsh when possible.
  • Paths with spaces need quotes: cd "C:\My Projects".

On this page