concept switch parameter in category powershell

appears as: switch parameters, switch parameter
Windows PowerShell in Action, Third Edition

This is an excerpt from Manning's book Windows PowerShell in Action, Third Edition.

The final element of the basic command pattern is the switch parameter. These are parameters that don’t require an argument. They’re usually either present or absent (obviously they can’t be positional). A good example is the -Recurse parameter on the Get-ChildItem command. This switch tells the Get-ChildItem command to display files from a specified directory as well as all its subdirectories:

Switch parameters are the opposite; you specify the parameter but the argument is left out. The interpreter assigns the parameter a value based on whether the parameter is present or absent. The -Recurse parameter for Get-ChildItem is a good example. If it’s present, you’ll get a recursive directory listing starting at the current directory.

sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest