Commands That Explain Themselves

Verb-noun names, parameters, short names, and finding and reading help for any command.

Updated

Names

  1. Verb-Noun: Names That Explain Themselves (Novice): Every PowerShell command is named with a verb, a dash and a noun, such as Get-Process, so once you know the pattern you can guess a command's name before you look it up, and Get-Verb lists the verbs.
  2. Parameters, Values and Switches (Novice): A parameter tells a command more about what you want, written as a dash and a name with a value after it, or as a switch with no value, and Tab and Ctrl+Space show you every parameter a command has.
  3. Short Names: Aliases (Novice): An alias is a short second name for a command, such as ls or dir for Get-ChildItem, and Get-Alias shows what an alias really runs, so you can use short names at the prompt and full names in scripts.

Help

  1. Finding a Command: Get-Command (Apprentice): Get-Command searches every command PowerShell knows, by its exact name, by its verb or noun, or by part of a name with the * wildcard, and shows what kind of command each one is and which module it comes from, without running it.
  2. Reading Help: Get-Help (Apprentice): Get-Help shows a command's help page once Update-Help has downloaded it, and its examples, its syntax lines and the about_ topics let you work out a command you've never seen before you run it.

Exercise: Guess the Command

  1. Exercise: Guess the Command (Apprentice): Answer eight questions from a bike shop's owner by guessing verb-noun commands and checking them with Get-Command, Get-Alias and Get-Help, write the answers in answers.txt, and let a Pester check tell you which are right.