Switch parameters

Switch parameters have no arguments (values); the presence of a switch parameter is sufficient. For example, Recurse is a switch parameter for Get-ChildItem:

SYNTAX
Get-ChildItem ... [-Recurse] ...

As with the other types of parameters, optional use is denoted by square brackets. Switch parameters, by default, are false (not set). If a switch parameter is true (set) by default, it is possible to set the value to false using the notation, as shown in the following code:

Get-ChildItem -Recurse:$false 

In the case of Get-ChildItem, this does nothing; this technique is most widely used with the Confirm switch parameter, which we will discuss later in this chapter.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.143.4.181