Cmdlets and Syntax
Master the Verb-Noun naming convention, parameters, aliases, and how to discover any cmdlet.
What You'll Learn
- The Verb-Noun naming convention and standard verbs
- Named, positional, and switch parameters
- Built-in aliases (ls, cd, cat, cp, mv, rm)
- Discovering cmdlets with Get-Command and Get-Help
The Verb-Noun Convention
PowerShell's killer feature is its consistent naming. Every cmdlet follows the pattern Verb-Noun. The verb says what you're doing; the noun says what you're doing it to. Once you learn the pattern, you can guess cmdlet names correctly.
๐ฏ Real-World Analogy: Imagine if every app on your phone followed the same menu structure. "Get" always means view, "Set" always means change. That's PowerShell โ predictable by design.
Get-Process # Get = retrieve, Process = target Stop-Service # Stop = end, Service = target New-Item # New = create, Item = target Remove-Variable # Remove = delete, Variable = target
To see all approved verbs: Get-Verb. Microsoft maintains a standard list โ using non-standard verbs generates warnings when importing modules.
Verb-Noun Convention
Explore standard verbs and how to discover cmdlets.
// PowerShell Cmdlets โ simulated in JavaScript
console.log("=== The Verb-Noun Convention ===");
console.log();
console.log("Every cmdlet follows: Verb-Noun");
console.log("The verb describes the ACTION, the noun the TARGET.");
console.log();
const verbs = [
{ verb: "Get", meaning: "Retrieve data", example: "Get-Process, Get-Service" },
{ verb: "Set", meaning: "Change/configure", example: "Set-Location, Set-Content" },
{ verb: "New", meaning: "Create something", example: "New-Ite
...Parameters and Aliases
Cmdlets accept parameters to customise their behaviour. Parameters start with a dash (-) and can be named, positional, or switches:
# Named parameter (explicit) Get-ChildItem -Path C:\Users -Filter "*.log" # Positional parameter (implicit) Get-ChildItem C:\Users # Switch parameter (boolean flag) Get-ChildItem -Recurse # Common parameters (available on ALL cmdlets) Get-Process -Verbose -ErrorAction Stop
PowerShell also supports parameter abbreviation โ you only need enough characters to be unique: -Re for -Recurse, -Pa for -Path.
โ ๏ธ Common Mistake
Don't confuse Write-Host with Write-Output. Write-Host prints to the console but doesn't pass data down the pipeline. Use Write-Output (or just return values) for pipeline-compatible output.
Parameters & Aliases
See how parameters work and discover built-in aliases.
// Parameters & Aliases โ simulated in JavaScript
console.log("=== Named Parameters ===");
console.log();
console.log("Cmdlets accept named parameters with a dash:");
console.log();
console.log(' PS> Get-ChildItem -Path C:\\Users -Recurse -Filter "*.txt"');
console.log(" -Path โ target directory");
console.log(" -Recurse โ search subdirectories (switch)");
console.log(" -Filter โ pattern to match");
console.log();
console.log("=== Positional Parameters ===");
console.log(
...๐ก Pro Tip
Use Get-Help cmdlet -Examples to see real usage examples for any cmdlet. This is the fastest way to learn new cmdlets โ skip the theory and see them in action.
๐ Quick Reference
| Cmdlet | Purpose |
|---|---|
| Get-Command | Find cmdlets by name, verb, or noun |
| Get-Help | Show documentation for any cmdlet |
| Get-Verb | List all approved PowerShell verbs |
| Get-Alias | Show alias โ cmdlet mappings |
| Set-Alias | Create custom shortcut aliases |
๐ Lesson Complete!
You've mastered the Verb-Noun convention, parameters, and aliases. Next up: working with variables and data types in PowerShell.
Sign up for free to track which lessons you've completed and get learning reminders.