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.

    Try it Yourself ยป
    JavaScript
    // 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.

    Try it Yourself ยป
    JavaScript
    // 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

    CmdletPurpose
    Get-CommandFind cmdlets by name, verb, or noun
    Get-HelpShow documentation for any cmdlet
    Get-VerbList all approved PowerShell verbs
    Get-AliasShow alias โ†’ cmdlet mappings
    Set-AliasCreate 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.

    Previous

    Cookie & Privacy Settings

    We use cookies to improve your experience, analyze traffic, and show personalized ads. You can manage your preferences below.

    By clicking "Accept All", you consent to our use of cookies for analytics and personalized advertising. You can customize your preferences or reject non-essential cookies.

    Privacy Policy โ€ข Terms of Service