Chapter 9. Avoiding bugs: start with a command

Before we ever fire up a script editor, we start in the basic PowerShell command-line window. This is your lowest common denominator for testing, and it’s a perfect way to make sure the commands your tool will run are correct. It’s way easier to debug or troubleshoot a single command from an interactive console than it is to debug an entire script. And by “a single command,” we mean a PowerShell expression—a single thing that we can manually type into the console to see if we’ve got the right syntax.

This is by design

One of the cool parts about PowerShell is that you can open a console, run commands, and get immediate results (or errors). Traditionally, programmers have had to write ...

Get Learn PowerShell Scripting in a Month of Lunches now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.