Switch Parameter
noun
say it: “SWICH puh-RAM-ih-ter” /swɪtʃ pəˈræmɪtər/
A PowerShell parameter that takes no value: writing it turns an option on, and leaving it out leaves it off.
What is a switch parameter in PowerShell?
A switch parameter has no value after it: writing it turns it on, and leaving it out leaves it off, like a light switch. -Force on Get-ChildItem is one: it adds hidden files to the list.
Get-ChildItem -Force # the switch is on: hidden files show too
In a sentence
- “Leaving the switch parameter out kept the hidden files out of the list.”
- “-Force is a switch parameter, so you write it with nothing after it.”
Level: Novice · More PowerShell terms at this level
Updated