Chapter 2. Foundations of PowerShell

 

This chapter covers:

  • 2.1 Getting a sense of the PowerShell language
  • 2.2 The core concepts
  • 2.3 Aliases and elastic syntax
  • 2.4 Parsing and PowerShell
  • 2.5 How the pipeline works
  • 2.6 Formatting and output
  • 2.7 Summary

“Begin at the beginning,” the king said “and then go on till you come to the end, then stop.”

Lewis Carroll, Alice in Wonderland

Vizzini: Inconceivable!

Inigo: You keep on using that word. I do not think it means what you think it means.

William Goldman, The Princess Bride

This chapter introduces the foundational concepts underlying the PowerShell language and its environment. We’ll cover language details that are specific to PowerShell and look at how the interpreter parses the commands we type. This chapter also covers the various types of commands you’ll encounter along with the anatomy and operation of the pipeline itself. We’ll look at the basic syntax for expressions and commands, including how to add comments to scripts and how arguments and parameters are handled. Finally, we’ll close the chapter with a discussion of how the formatting and output subsystem works in PowerShell.

The chapter presents many examples that aren’t completely explained. If you don’t understand everything when you read the examples, don’t worry—we’ll revisit the material in later chapters. In this chapter, we just want to cover the core concepts—we’ll focus on the details in subsequent chapters.

2.1. Getting a Sense of the PowerShell Language

2.2. The Core Concepts

2.3. Aliases and Elastic Syntax

2.4. Parsing and PowerShell

2.5. How the Pipeline Works

2.6. Formatting and Output

2.7. Summary