diff --git a/reference/5.1/CimCmdlets/New-CimSession.md b/reference/5.1/CimCmdlets/New-CimSession.md index 687175f80302..a9f84fa49aa4 100644 --- a/reference/5.1/CimCmdlets/New-CimSession.md +++ b/reference/5.1/CimCmdlets/New-CimSession.md @@ -331,8 +331,8 @@ By default, the `New-CimSession` cmdlet establishes a connection with a remote W endpoint for two reasons: to verify that the remote server is listening on the port number that is specified using the **Port** parameter, and to verify the specified account credentials. The verification is accomplished using a standard WS-Identity operation. You can add the -**SkipTestConnection** switch parameter if the remote WS-Management endpoint cannot use WS-Identify, -or to reduce some data transmission time. +**SkipTestConnection** `[switch]` parameter if the remote WS-Management endpoint cannot use +WS-Identify, or to reduce some data transmission time. ```yaml Type: System.Management.Automation.SwitchParameter diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Command_Syntax.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Command_Syntax.md index 0cbfa2cb82a1..eb54a11d33e4 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Command_Syntax.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Command_Syntax.md @@ -198,19 +198,18 @@ The syntax diagrams use the following symbols: - Parameters with no values Some parameters don't accept input, so they don't have a parameter value. - Parameters without values are _switch parameters_. Switch parameters are used - like boolean values. They default to `$false`. When you use a switch - parameter, the value is set to `$true`. + Parameters without values are _`[switch]` parameters_. `[switch]` parameters + are used like boolean values. They default to `$false`. When you use a + `[switch]` parameter, the value is set to `$true`. - For example, the **ListImported** parameter of `Get-Command` is a switch - parameter. When you use the **ListImported** parameter, the cmdlet return + For example, the **ListImported** parameter of `Get-Command` is a `[switch]` + parameter. When you use the **ListImported** parameter, the cmdlet returns only commands that were imported from modules in the current session. ```Syntax Get-Command [-ListImported] ``` - - Brackets `[ ]` around parameters indicate optional items. A parameter and its value can be optional. For example, the **CommandType** parameter of `Get-Command` and its value are enclosed in brackets because they're both diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions.md index c0334ae13d05..98986fd78f55 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Functions.md @@ -239,7 +239,7 @@ For more information about the standard PowerShell verbs, see ## Functions with parameters You can use parameters with functions, including named parameters, positional -parameters, switch parameters, and dynamic parameters. For more information +parameters, `[switch]` parameters, and dynamic parameters. For more information about dynamic parameters in functions, see [about_Functions_Advanced_Parameters][09]. @@ -379,13 +379,12 @@ Get-Extension myTextFile myTextFile.txt ``` -### Switch parameters +### `[switch]` parameters A switch is a parameter that doesn't require a value. Instead, you type the -function name followed by the name of the switch parameter. +function name followed by the name of the `[switch]` parameter. -To define a switch parameter, specify the type `[switch]` before the parameter -name, as shown in the following example: +The following example shows how you define a `[switch]` parameter: ```powershell function Switch-Item { @@ -395,8 +394,9 @@ function Switch-Item { } ``` -When you type the `On` switch parameter after the function name, the function -displays `Switch on`. Without the switch parameter, it displays `Switch off`. +When you type the `On` `[switch]` parameter after the function name, the +function displays `Switch on`. Without the `[switch]` parameter, it displays +`Switch off`. ```powershell Switch-Item -On diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md index b231fe3690e4..750508f33337 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md @@ -104,8 +104,8 @@ $PSDefaultParameterValues = @{ ``` The cmdlet and parameter names can contain wildcard characters. Use `$true` and -`$false` to set values for switch parameters, such as **Verbose**. This example -sets the common parameter **Verbose** to `$true` for all commands. +`$false` to set values for `[switch]` parameters, such as **Verbose**. This +example sets the common parameter **Verbose** to `$true` for all commands. ```powershell $PSDefaultParameterValues = @{'*:Verbose'=$true} @@ -162,9 +162,9 @@ You can use a scriptblock to specify different default values for a parameter under different conditions. PowerShell evaluates the scriptblock and uses the result as the default parameter value. -The `Format-Table:AutoSize` key sets that switch parameter to a default value -of `$true` The `if` statement contains a condition that the `$Host.Name` must -be `ConsoleHost`. +The `Format-Table:AutoSize` key sets that `[switch]` parameter to a default +value of `$true`. The `if` statement contains a condition that the `$Host.Name` +must be `ConsoleHost`. ```powershell $PSDefaultParameterValues = @{ diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Requires.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Requires.md index f5e2c8c4b39f..b0a543d48ecc 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Requires.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Requires.md @@ -211,11 +211,11 @@ For example: #### -RunAsAdministrator -When this switch parameter is added to your `#Requires` statement, it specifies -that the PowerShell session in which you're running the script must be started -with elevated user rights. The **RunAsAdministrator** parameter is ignored on a -non-Windows operating system. The **RunAsAdministrator** parameter was -introduced in PowerShell 4.0. +When this `[switch]` parameter is added to your `#Requires` statement, it +specifies that the PowerShell session in which you're running the script must +be started with elevated user rights. The **RunAsAdministrator** parameter is +ignored on a non-Windows operating system. The **RunAsAdministrator** parameter +was introduced in PowerShell 4.0. For example: diff --git a/reference/5.1/Microsoft.PowerShell.Core/About/about_Splatting.md b/reference/5.1/Microsoft.PowerShell.Core/About/about_Splatting.md index c119df374449..2783f756404a 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/About/about_Splatting.md +++ b/reference/5.1/Microsoft.PowerShell.Core/About/about_Splatting.md @@ -49,7 +49,7 @@ command so you don't pass more than one value for each parameter. ## Splatting with hash tables Use a hash table to splat parameter name and value pairs. You can use this -format for all parameter types, including positional and switch parameters. +format for all parameter types, including positional and `[switch]` parameters. Positional parameters must be assigned by name. The following examples compare two `Copy-Item` commands that copy the Test.txt @@ -68,7 +68,7 @@ table of parameter-name and parameter-value pairs and stores it in the variable in a command with splatting. The At symbol (`@HashArguments`) replaces the dollar sign (`$HashArguments`) in the command. -To provide a value for the **WhatIf** switch parameter, use `$true` or +To provide a value for the **WhatIf** `[switch]` parameter, use `$true` or `$false`. ```powershell diff --git a/reference/5.1/Microsoft.PowerShell.Core/Disable-PSRemoting.md b/reference/5.1/Microsoft.PowerShell.Core/Disable-PSRemoting.md index cc81423447a5..a17495599680 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/Disable-PSRemoting.md +++ b/reference/5.1/Microsoft.PowerShell.Core/Disable-PSRemoting.md @@ -212,7 +212,7 @@ A loopback connection is created when the following conditions are met: - The computer name to connect to is 'localhost'. - No credentials are passed in. Current logged in user (implicit credentials) is used for the connection. -- The **EnableNetworkAccess** switch parameter is used. +- The **EnableNetworkAccess** `[switch]` parameter is used. For more information on loopback connections, see [New-PSSession](New-PSSession.md) document. diff --git a/reference/5.1/Microsoft.PowerShell.Core/Get-Help.md b/reference/5.1/Microsoft.PowerShell.Core/Get-Help.md index 100dab982437..f8a6565d5556 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/Get-Help.md +++ b/reference/5.1/Microsoft.PowerShell.Core/Get-Help.md @@ -191,7 +191,7 @@ Get-Help Format-Table -Parameter GroupBy ``` The **Examples** parameter displays the help file's **NAME** and **SYNOPSIS** sections, and all the -Examples. You can't specify an Example number because the **Examples** parameter is a switch +Examples. You can't specify an Example number because the **Examples** parameter is a `[switch]` parameter. The **Parameter** parameter displays only the descriptions of the specified parameters. If you diff --git a/reference/5.1/Microsoft.PowerShell.Core/Where-Object.md b/reference/5.1/Microsoft.PowerShell.Core/Where-Object.md index c3c3594cb8f2..510d7507feb2 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/Where-Object.md +++ b/reference/5.1/Microsoft.PowerShell.Core/Where-Object.md @@ -256,9 +256,9 @@ command. All PowerShell comparison operators are valid in the scriptblock format. For more information, see [about_Comparison_Operators](./About/about_Comparison_Operators.md). -- **Simplified syntax**. To enable the simiplified syntax, `Where-Object` includes 31 switch +- **Simplified syntax**. To enable the simplified syntax, `Where-Object` includes 31 `[switch]` parameters that represent the comparison operators. The simplified syntax is easier to read and - write than the scriptblock syntax. You can combine one of the switch parameters with the + write than the scriptblock syntax. You can combine one of the `[switch]` parameters with the **Property** and **Value** parameters to create a command that filters objects based on the values of their properties. @@ -271,7 +271,7 @@ command. As shown in the example, the parameter names **Property** and **Value** are optional. The **Property** parameter is a positional parameter mapped to position `0`. The **Value** parameter - is a positional parameter mapped to position `1`. The switch parameter, used to specify the + is a positional parameter mapped to position `1`. The `[switch]` parameter, used to specify the comparison, can be used in any position. The simplified syntax was introduced in Windows PowerShell 3.0. For more information, see diff --git a/reference/5.1/Microsoft.PowerShell.Utility/Show-Command.md b/reference/5.1/Microsoft.PowerShell.Utility/Show-Command.md index ec5078d4719f..d8be16f1747a 100644 --- a/reference/5.1/Microsoft.PowerShell.Utility/Show-Command.md +++ b/reference/5.1/Microsoft.PowerShell.Utility/Show-Command.md @@ -35,10 +35,10 @@ all installed modules. To find the commands in a module, select the module from drop-down list. To select a command, click the command name. To use the command window, select a command, either by using the Name or by clicking the command -name in the **Commands** list. Each parameter set is displayed on a separate tab. Asterisks indicate -the mandatory parameters. To enter values for a parameter, type the value in the text box or select -the value from the drop-down box. To add a switch parameter, click to select the parameter check -box. +name in the **Commands** list. Each parameter set is displayed on a separate tab. Asterisks +indicate the mandatory parameters. To enter values for a parameter, type the value in the text box +or select the value from the drop-down box. To add a `[switch]` parameter, click to select the +parameter check box. When you're ready, you can click **Copy** to copy the command that you've created to the clipboard or click **Run** to run the command. You can also use the **PassThru** parameter to return the diff --git a/reference/7.4/CimCmdlets/New-CimSession.md b/reference/7.4/CimCmdlets/New-CimSession.md index e33f602ed563..a00e50d04f72 100644 --- a/reference/7.4/CimCmdlets/New-CimSession.md +++ b/reference/7.4/CimCmdlets/New-CimSession.md @@ -333,8 +333,8 @@ By default, the `New-CimSession` cmdlet establishes a connection with a remote W endpoint for two reasons: to verify that the remote server is listening on the port number that is specified using the **Port** parameter, and to verify the specified account credentials. The verification is accomplished using a standard WS-Identity operation. You can add the -**SkipTestConnection** switch parameter if the remote WS-Management endpoint cannot use WS-Identify, -or to reduce some data transmission time. +**SkipTestConnection** `[switch]` parameter if the remote WS-Management endpoint cannot use +WS-Identify, or to reduce some data transmission time. ```yaml Type: System.Management.Automation.SwitchParameter diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Command_Syntax.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Command_Syntax.md index 9b275b6a46f8..d7f773f1ebc8 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Command_Syntax.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Command_Syntax.md @@ -198,19 +198,18 @@ The syntax diagrams use the following symbols: - Parameters with no values Some parameters don't accept input, so they don't have a parameter value. - Parameters without values are _switch parameters_. Switch parameters are used - like boolean values. They default to `$false`. When you use a switch - parameter, the value is set to `$true`. + Parameters without values are _`[switch]` parameters_. `[switch]` parameters + are used like boolean values. They default to `$false`. When you use a + `[switch]` parameter, the value is set to `$true`. - For example, the **ListImported** parameter of `Get-Command` is a switch - parameter. When you use the **ListImported** parameter, the cmdlet return + For example, the **ListImported** parameter of `Get-Command` is a `[switch]` + parameter. When you use the **ListImported** parameter, the cmdlet returns only commands that were imported from modules in the current session. ```Syntax Get-Command [-ListImported] ``` - - Brackets `[ ]` around parameters indicate optional items. A parameter and its value can be optional. For example, the **CommandType** parameter of `Get-Command` and its value are enclosed in brackets because they're both diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Functions.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Functions.md index 466d1276527b..55b304340433 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Functions.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Functions.md @@ -263,7 +263,7 @@ For more information about the standard PowerShell verbs, see ## Functions with parameters You can use parameters with functions, including named parameters, positional -parameters, switch parameters, and dynamic parameters. For more information +parameters, `[switch]` parameters, and dynamic parameters. For more information about dynamic parameters in functions, see [about_Functions_Advanced_Parameters][09]. @@ -403,13 +403,12 @@ Get-Extension myTextFile myTextFile.txt ``` -### Switch parameters +### `[switch]` parameters A switch is a parameter that doesn't require a value. Instead, you type the -function name followed by the name of the switch parameter. +function name followed by the name of the `[switch]` parameter. -To define a switch parameter, specify the type `[switch]` before the parameter -name, as shown in the following example: +The following example shows how you define a `[switch]` parameter: ```powershell function Switch-Item { @@ -419,8 +418,9 @@ function Switch-Item { } ``` -When you type the `On` switch parameter after the function name, the function -displays `Switch on`. Without the switch parameter, it displays `Switch off`. +When you type the `On` `[switch]` parameter after the function name, the +function displays `Switch on`. Without the `[switch]` parameter, it displays +`Switch off`. ```powershell Switch-Item -On diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md index a991d55df656..c31ff73921ad 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md @@ -104,8 +104,8 @@ $PSDefaultParameterValues = @{ ``` The cmdlet and parameter names can contain wildcard characters. Use `$true` and -`$false` to set values for switch parameters, such as **Verbose**. This example -sets the common parameter **Verbose** to `$true` for all commands. +`$false` to set values for `[switch]` parameters, such as **Verbose**. This +example sets the common parameter **Verbose** to `$true` for all commands. ```powershell $PSDefaultParameterValues = @{'*:Verbose'=$true} @@ -162,9 +162,9 @@ You can use a scriptblock to specify different default values for a parameter under different conditions. PowerShell evaluates the scriptblock and uses the result as the default parameter value. -The `Format-Table:AutoSize` key sets that switch parameter to a default value -of `$true` The `if` statement contains a condition that the `$Host.Name` must -be `ConsoleHost`. +The `Format-Table:AutoSize` key sets that `[switch]` parameter to a default +value of `$true`. The `if` statement contains a condition that the `$Host.Name` +must be `ConsoleHost`. ```powershell $PSDefaultParameterValues = @{ diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md index f1e5b73b2629..21d44eccc19c 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md @@ -198,8 +198,8 @@ Get-Module -ListAvailable BitsTransfer # No output ``` -In both cases, the `-SkipEditionCheck` switch parameter can be used to override -this behavior: +In both cases, the `-SkipEditionCheck` `[switch]` parameter can be used to +override this behavior: ```powershell Get-Module -ListAvailable -SkipEditionCheck BitsTransfer diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Pwsh.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Pwsh.md index 90e31cca00c5..364666ceda68 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Pwsh.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Pwsh.md @@ -69,15 +69,15 @@ and any parameters. File must be the last parameter in the command, because all characters typed after the File parameter name are interpreted as the script filepath followed by the script parameters. -Typically, the switch parameters of a script are either included or omitted. -For example, the following command uses the **All** parameter of the +Typically, the `[switch]` parameters of a script are either included or +omitted. For example, the following command uses the **All** parameter of the `Get-Script.ps1` script file: `-File .\Get-Script.ps1 -All` -In rare cases, you might need to provide a **Boolean** value for a switch -parameter. To provide a **Boolean** value for a switch parameter in the value -of the **File** parameter, Use the parameter normally followed immediately by a -colon and the boolean value, such as the following: -`-File .\Get-Script.ps1 -All:$false`. +In rare cases, you might need to provide a **Boolean** value for a `[switch]` +parameter. To provide a **Boolean** value for a `[switch]` parameter in the +value of the **File** parameter, use the parameter normally followed +immediately by a colon and the boolean value, such as the following: `-File +.\Get-Script.ps1 -All:$false`. Parameters passed to the script are passed as literal strings, after interpretation by the current shell. For example, if you are in `cmd.exe` and diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Requires.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Requires.md index 88c83c0a8668..04ebf64ae8a4 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Requires.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Requires.md @@ -183,11 +183,11 @@ For example: #### -RunAsAdministrator -When this switch parameter is added to your `#Requires` statement, it specifies -that the PowerShell session in which you're running the script must be started -with elevated user rights. The **RunAsAdministrator** parameter is ignored on a -non-Windows operating system. The **RunAsAdministrator** parameter was -introduced in PowerShell 4.0. +When this `[switch]` parameter is added to your `#Requires` statement, it +specifies that the PowerShell session in which you're running the script must +be started with elevated user rights. The **RunAsAdministrator** parameter is +ignored on a non-Windows operating system. The **RunAsAdministrator** parameter +was introduced in PowerShell 4.0. For example: diff --git a/reference/7.4/Microsoft.PowerShell.Core/About/about_Splatting.md b/reference/7.4/Microsoft.PowerShell.Core/About/about_Splatting.md index d27ea6e3fbd8..29ddff1c0399 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/About/about_Splatting.md +++ b/reference/7.4/Microsoft.PowerShell.Core/About/about_Splatting.md @@ -52,7 +52,7 @@ defining a parameter in a command. ## Splatting with hash tables Use a hash table to splat parameter name and value pairs. You can use this -format for all parameter types, including positional and switch parameters. +format for all parameter types, including positional and `[switch]` parameters. Positional parameters must be assigned by name. The following examples compare two `Copy-Item` commands that copy the Test.txt @@ -71,7 +71,7 @@ table of parameter-name and parameter-value pairs and stores it in the variable in a command with splatting. The At symbol (`@HashArguments`) replaces the dollar sign (`$HashArguments`) in the command. -To provide a value for the **WhatIf** switch parameter, use `$true` or +To provide a value for the **WhatIf** `[switch]` parameter, use `$true` or `$false`. ```powershell diff --git a/reference/7.4/Microsoft.PowerShell.Core/Disable-PSRemoting.md b/reference/7.4/Microsoft.PowerShell.Core/Disable-PSRemoting.md index 11bc6555cc04..ba6ac27ee71c 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/Disable-PSRemoting.md +++ b/reference/7.4/Microsoft.PowerShell.Core/Disable-PSRemoting.md @@ -235,7 +235,7 @@ A loopback connection is created when the following conditions are met: - The computer name to connect to is 'localhost'. - No credentials are passed in. Current logged in user (implicit credentials) is used for the connection. -- The **EnableNetworkAccess** switch parameter is used. +- The **EnableNetworkAccess** `[switch]` parameter is used. For more information on loopback connections, see [New-PSSession](New-PSSession.md) document. diff --git a/reference/7.4/Microsoft.PowerShell.Core/Get-Help.md b/reference/7.4/Microsoft.PowerShell.Core/Get-Help.md index 9aa538cc862d..b9dfc0d913bb 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/Get-Help.md +++ b/reference/7.4/Microsoft.PowerShell.Core/Get-Help.md @@ -191,7 +191,7 @@ Get-Help Format-Table -Parameter GroupBy ``` The **Examples** parameter displays the help file's **NAME** and **SYNOPSIS** sections, and all the -Examples. You can't specify an Example number because the **Examples** parameter is a switch +Examples. You can't specify an Example number because the **Examples** parameter is a `[switch]` parameter. The **Parameter** parameter displays only the descriptions of the specified parameters. If you diff --git a/reference/7.4/Microsoft.PowerShell.Core/Where-Object.md b/reference/7.4/Microsoft.PowerShell.Core/Where-Object.md index cd686687ffa4..33495034ace6 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/Where-Object.md +++ b/reference/7.4/Microsoft.PowerShell.Core/Where-Object.md @@ -263,9 +263,9 @@ command. All PowerShell comparison operators are valid in the scriptblock format. For more information, see [about_Comparison_Operators](./About/about_Comparison_Operators.md). -- **Simplified syntax**. To enable the simiplified syntax, `Where-Object` includes 31 switch +- **Simplified syntax**. To enable the simplified syntax, `Where-Object` includes 31 `[switch]` parameters that represent the comparison operators. The simplified syntax is easier to read and - write than the scriptblock syntax. You can combine one of the switch parameters with the + write than the scriptblock syntax. You can combine one of the `[switch]` parameters with the **Property** and **Value** parameters to create a command that filters objects based on the values of their properties. @@ -278,7 +278,7 @@ command. As shown in the example, the parameter names **Property** and **Value** are optional. The **Property** parameter is a positional parameter mapped to position `0`. The **Value** parameter - is a positional parameter mapped to position `1`. The switch parameter, used to specify the + is a positional parameter mapped to position `1`. The `[switch]` parameter, used to specify the comparison, can be used in any position. The simplified syntax was introduced in Windows PowerShell 3.0. For more information, see diff --git a/reference/7.4/Microsoft.PowerShell.Management/Resolve-Path.md b/reference/7.4/Microsoft.PowerShell.Management/Resolve-Path.md index 863e3bcf1011..5ad633a4e506 100644 --- a/reference/7.4/Microsoft.PowerShell.Management/Resolve-Path.md +++ b/reference/7.4/Microsoft.PowerShell.Management/Resolve-Path.md @@ -113,8 +113,8 @@ Resolve-Path -LiteralPath 'test[xml]' ### Example 7: Resolve a path relative to another folder This example uses the **RelativeBasePath** parameter to resolve the path of the `pwsh` executable -relative to `$Env:TEMP`. When the command includes the **Relative** switch parameter, it returns a -**String** representing the relative path from `$Env:TEMP` to the `pwsh` executable. +relative to `$Env:TEMP`. When the command includes the **Relative** `[switch]` parameter, it +returns a **String** representing the relative path from `$Env:TEMP` to the `pwsh` executable. ```powershell $ExecutablePath = Get-Command -Name pwsh | Select-Object -ExpandProperty Source @@ -211,7 +211,7 @@ Accept wildcard characters: False Specifies a path to resolve the relative path from. When you use this parameter, the cmdlet returns the **System.Management.Automation.PathInfo** object for the resolved path. -When you use this parameter with the **Relative** switch parameter, the cmdlet returns a string +When you use this parameter with the **Relative** `[switch]` parameter, the cmdlet returns a string representing the relative path from **RelativeBasePath** to **Path**. This parameter was added in PowerShell 7.4. diff --git a/reference/7.4/Microsoft.PowerShell.Utility/ConvertTo-Json.md b/reference/7.4/Microsoft.PowerShell.Utility/ConvertTo-Json.md index c479db0ef6bc..07000e30d057 100644 --- a/reference/7.4/Microsoft.PowerShell.Utility/ConvertTo-Json.md +++ b/reference/7.4/Microsoft.PowerShell.Utility/ConvertTo-Json.md @@ -81,8 +81,8 @@ Get-Date | ConvertTo-Json; Get-Date | ConvertTo-Json -AsArray ] ``` -This example shows the output from `ConvertTo-Json` cmdlet with and without the **AsArray** switch -parameter. You can see the second portion of the output is wrapped in array brackets. +This example shows the output from the `ConvertTo-Json` cmdlet with and without the **AsArray** +`[switch]` parameter. You can see the second portion of the output is wrapped in array brackets. ### Example 3 diff --git a/reference/7.4/Microsoft.PowerShell.Utility/Show-Command.md b/reference/7.4/Microsoft.PowerShell.Utility/Show-Command.md index 7acc9fc0027b..b605729f4225 100644 --- a/reference/7.4/Microsoft.PowerShell.Utility/Show-Command.md +++ b/reference/7.4/Microsoft.PowerShell.Utility/Show-Command.md @@ -37,10 +37,10 @@ all installed modules. To find the commands in a module, select the module from drop-down list. To select a command, click the command name. To use the command window, select a command, either by using the Name or by clicking the command -name in the **Commands** list. Each parameter set is displayed on a separate tab. Asterisks indicate -the mandatory parameters. To enter values for a parameter, type the value in the text box or select -the value from the drop-down box. To add a switch parameter, click to select the parameter check -box. +name in the **Commands** list. Each parameter set is displayed on a separate tab. Asterisks +indicate the mandatory parameters. To enter values for a parameter, type the value in the text box +or select the value from the drop-down box. To add a `[switch]` parameter, click to select the +parameter check box. When you're ready, you can click **Copy** to copy the command that you've created to the clipboard or click **Run** to run the command. You can also use the **PassThru** parameter to return the diff --git a/reference/7.5/CimCmdlets/New-CimSession.md b/reference/7.5/CimCmdlets/New-CimSession.md index 9e601fd89f51..a7727bfe3e2b 100644 --- a/reference/7.5/CimCmdlets/New-CimSession.md +++ b/reference/7.5/CimCmdlets/New-CimSession.md @@ -333,8 +333,8 @@ By default, the `New-CimSession` cmdlet establishes a connection with a remote W endpoint for two reasons: to verify that the remote server is listening on the port number that is specified using the **Port** parameter, and to verify the specified account credentials. The verification is accomplished using a standard WS-Identity operation. You can add the -**SkipTestConnection** switch parameter if the remote WS-Management endpoint cannot use WS-Identify, -or to reduce some data transmission time. +**SkipTestConnection** `[switch]` parameter if the remote WS-Management endpoint cannot use +WS-Identify, or to reduce some data transmission time. ```yaml Type: System.Management.Automation.SwitchParameter diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Command_Syntax.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Command_Syntax.md index 0f7f31b98845..b1cb074b139f 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Command_Syntax.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Command_Syntax.md @@ -198,19 +198,18 @@ The syntax diagrams use the following symbols: - Parameters with no values Some parameters don't accept input, so they don't have a parameter value. - Parameters without values are _switch parameters_. Switch parameters are used - like boolean values. They default to `$false`. When you use a switch - parameter, the value is set to `$true`. + Parameters without values are _`[switch]` parameters_. `[switch]` parameters + are used like boolean values. They default to `$false`. When you use a + `[switch]` parameter, the value is set to `$true`. - For example, the **ListImported** parameter of `Get-Command` is a switch - parameter. When you use the **ListImported** parameter, the cmdlet return + For example, the **ListImported** parameter of `Get-Command` is a `[switch]` + parameter. When you use the **ListImported** parameter, the cmdlet returns only commands that were imported from modules in the current session. ```Syntax Get-Command [-ListImported] ``` - - Brackets `[ ]` around parameters indicate optional items. A parameter and its value can be optional. For example, the **CommandType** parameter of `Get-Command` and its value are enclosed in brackets because they're both diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Functions.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Functions.md index e729af388ff1..5c7aee7a1cd8 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Functions.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Functions.md @@ -263,7 +263,7 @@ For more information about the standard PowerShell verbs, see ## Functions with parameters You can use parameters with functions, including named parameters, positional -parameters, switch parameters, and dynamic parameters. For more information +parameters, `[switch]` parameters, and dynamic parameters. For more information about dynamic parameters in functions, see [about_Functions_Advanced_Parameters][09]. @@ -403,13 +403,12 @@ Get-Extension myTextFile myTextFile.txt ``` -### Switch parameters +### `[switch]` parameters A switch is a parameter that doesn't require a value. Instead, you type the -function name followed by the name of the switch parameter. +function name followed by the name of the `[switch]` parameter. -To define a switch parameter, specify the type `[switch]` before the parameter -name, as shown in the following example: +The following example shows how you define a `[switch]` parameter: ```powershell function Switch-Item { @@ -419,8 +418,9 @@ function Switch-Item { } ``` -When you type the `On` switch parameter after the function name, the function -displays `Switch on`. Without the switch parameter, it displays `Switch off`. +When you type the `On` `[switch]` parameter after the function name, the +function displays `Switch on`. Without the `[switch]` parameter, it displays +`Switch off`. ```powershell Switch-Item -On diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md index aa8cb55b493d..64d69534942f 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md @@ -104,8 +104,8 @@ $PSDefaultParameterValues = @{ ``` The cmdlet and parameter names can contain wildcard characters. Use `$true` and -`$false` to set values for switch parameters, such as **Verbose**. This example -sets the common parameter **Verbose** to `$true` for all commands. +`$false` to set values for `[switch]` parameters, such as **Verbose**. This +example sets the common parameter **Verbose** to `$true` for all commands. ```powershell $PSDefaultParameterValues = @{'*:Verbose'=$true} @@ -162,9 +162,9 @@ You can use a scriptblock to specify different default values for a parameter under different conditions. PowerShell evaluates the scriptblock and uses the result as the default parameter value. -The `Format-Table:AutoSize` key sets that switch parameter to a default value -of `$true` The `if` statement contains a condition that the `$Host.Name` must -be `ConsoleHost`. +The `Format-Table:AutoSize` key sets that `[switch]` parameter to a default +value of `$true`. The `if` statement contains a condition that the `$Host.Name` +must be `ConsoleHost`. ```powershell $PSDefaultParameterValues = @{ diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md index 6d5d896fd91c..fa48dd4a06ea 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md @@ -198,8 +198,8 @@ Get-Module -ListAvailable BitsTransfer # No output ``` -In both cases, the `-SkipEditionCheck` switch parameter can be used to override -this behavior: +In both cases, the `-SkipEditionCheck` `[switch]` parameter can be used to +override this behavior: ```powershell Get-Module -ListAvailable -SkipEditionCheck BitsTransfer diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Pwsh.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Pwsh.md index 8fba3d4bec73..dfa22c00d750 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Pwsh.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Pwsh.md @@ -69,15 +69,15 @@ and any parameters. File must be the last parameter in the command, because all characters typed after the File parameter name are interpreted as the script filepath followed by the script parameters. -Typically, the switch parameters of a script are either included or omitted. -For example, the following command uses the **All** parameter of the +Typically, the `[switch]` parameters of a script are either included or +omitted. For example, the following command uses the **All** parameter of the `Get-Script.ps1` script file: `-File .\Get-Script.ps1 -All` -In rare cases, you might need to provide a **Boolean** value for a switch -parameter. To provide a **Boolean** value for a switch parameter in the value -of the **File** parameter, Use the parameter normally followed immediately by a -colon and the boolean value, such as the following: -`-File .\Get-Script.ps1 -All:$false`. +In rare cases, you might need to provide a **Boolean** value for a `[switch]` +parameter. To provide a **Boolean** value for a `[switch]` parameter in the +value of the **File** parameter, use the parameter normally followed +immediately by a colon and the boolean value, such as the following: `-File +.\Get-Script.ps1 -All:$false`. Parameters passed to the script are passed as literal strings, after interpretation by the current shell. For example, if you are in `cmd.exe` and diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Requires.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Requires.md index 406328a4be2d..b53c42199b3c 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Requires.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Requires.md @@ -183,11 +183,11 @@ For example: #### -RunAsAdministrator -When this switch parameter is added to your `#Requires` statement, it specifies -that the PowerShell session in which you're running the script must be started -with elevated user rights. The **RunAsAdministrator** parameter is ignored on a -non-Windows operating system. The **RunAsAdministrator** parameter was -introduced in PowerShell 4.0. +When this `[switch]` parameter is added to your `#Requires` statement, it +specifies that the PowerShell session in which you're running the script must +be started with elevated user rights. The **RunAsAdministrator** parameter is +ignored on a non-Windows operating system. The **RunAsAdministrator** parameter +was introduced in PowerShell 4.0. For example: diff --git a/reference/7.5/Microsoft.PowerShell.Core/About/about_Splatting.md b/reference/7.5/Microsoft.PowerShell.Core/About/about_Splatting.md index 8e74cf530400..e37d4cf06b43 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/About/about_Splatting.md +++ b/reference/7.5/Microsoft.PowerShell.Core/About/about_Splatting.md @@ -52,7 +52,7 @@ defining a parameter in a command. ## Splatting with hash tables Use a hash table to splat parameter name and value pairs. You can use this -format for all parameter types, including positional and switch parameters. +format for all parameter types, including positional and `[switch]` parameters. Positional parameters must be assigned by name. The following examples compare two `Copy-Item` commands that copy the Test.txt @@ -71,7 +71,7 @@ table of parameter-name and parameter-value pairs and stores it in the variable in a command with splatting. The At symbol (`@HashArguments`) replaces the dollar sign (`$HashArguments`) in the command. -To provide a value for the **WhatIf** switch parameter, use `$true` or +To provide a value for the **WhatIf** `[switch]` parameter, use `$true` or `$false`. ```powershell diff --git a/reference/7.5/Microsoft.PowerShell.Core/Disable-PSRemoting.md b/reference/7.5/Microsoft.PowerShell.Core/Disable-PSRemoting.md index efb9eb380446..29c138c39929 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/Disable-PSRemoting.md +++ b/reference/7.5/Microsoft.PowerShell.Core/Disable-PSRemoting.md @@ -236,7 +236,7 @@ A loopback connection is created when the following conditions are met: - The computer name to connect to is 'localhost'. - No credentials are passed in. Current logged in user (implicit credentials) is used for the connection. -- The **EnableNetworkAccess** switch parameter is used. +- The **EnableNetworkAccess** `[switch]` parameter is used. For more information on loopback connections, see [New-PSSession](New-PSSession.md) document. diff --git a/reference/7.5/Microsoft.PowerShell.Core/Get-Help.md b/reference/7.5/Microsoft.PowerShell.Core/Get-Help.md index c84b2e9a99ee..1035ccafcbf4 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/Get-Help.md +++ b/reference/7.5/Microsoft.PowerShell.Core/Get-Help.md @@ -191,7 +191,7 @@ Get-Help Format-Table -Parameter GroupBy ``` The **Examples** parameter displays the help file's **NAME** and **SYNOPSIS** sections, and all the -Examples. You can't specify an Example number because the **Examples** parameter is a switch +Examples. You can't specify an Example number because the **Examples** parameter is a `[switch]` parameter. The **Parameter** parameter displays only the descriptions of the specified parameters. If you diff --git a/reference/7.5/Microsoft.PowerShell.Core/Where-Object.md b/reference/7.5/Microsoft.PowerShell.Core/Where-Object.md index d10c9acde17d..0d0b94dc0455 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/Where-Object.md +++ b/reference/7.5/Microsoft.PowerShell.Core/Where-Object.md @@ -263,9 +263,9 @@ command. All PowerShell comparison operators are valid in the scriptblock format. For more information, see [about_Comparison_Operators](./About/about_Comparison_Operators.md). -- **Simplified syntax**. To enable the simiplified syntax, `Where-Object` includes 31 switch +- **Simplified syntax**. To enable the simplified syntax, `Where-Object` includes 31 `[switch]` parameters that represent the comparison operators. The simplified syntax is easier to read and - write than the scriptblock syntax. You can combine one of the switch parameters with the + write than the scriptblock syntax. You can combine one of the `[switch]` parameters with the **Property** and **Value** parameters to create a command that filters objects based on the values of their properties. @@ -278,7 +278,7 @@ command. As shown in the example, the parameter names **Property** and **Value** are optional. The **Property** parameter is a positional parameter mapped to position `0`. The **Value** parameter - is a positional parameter mapped to position `1`. The switch parameter, used to specify the + is a positional parameter mapped to position `1`. The `[switch]` parameter, used to specify the comparison, can be used in any position. The simplified syntax was introduced in Windows PowerShell 3.0. For more information, see diff --git a/reference/7.5/Microsoft.PowerShell.Management/Resolve-Path.md b/reference/7.5/Microsoft.PowerShell.Management/Resolve-Path.md index 6564915e0fd9..9bb6ff2b1b06 100644 --- a/reference/7.5/Microsoft.PowerShell.Management/Resolve-Path.md +++ b/reference/7.5/Microsoft.PowerShell.Management/Resolve-Path.md @@ -113,8 +113,8 @@ Resolve-Path -LiteralPath 'test[xml]' ### Example 7: Resolve a path relative to another folder This example uses the **RelativeBasePath** parameter to resolve the path of the `pwsh` executable -relative to `$Env:TEMP`. When the command includes the **Relative** switch parameter, it returns a -**String** representing the relative path from `$Env:TEMP` to the `pwsh` executable. +relative to `$Env:TEMP`. When the command includes the **Relative** `[switch]` parameter, it +returns a **String** representing the relative path from `$Env:TEMP` to the `pwsh` executable. ```powershell $ExecutablePath = Get-Command -Name pwsh | Select-Object -ExpandProperty Source @@ -266,7 +266,7 @@ Accept wildcard characters: False Specifies a path to resolve the relative path from. When you use this parameter, the cmdlet returns the **System.Management.Automation.PathInfo** object for the resolved path. -When you use this parameter with the **Relative** switch parameter, the cmdlet returns a string +When you use this parameter with the **Relative** `[switch]` parameter, the cmdlet returns a string representing the relative path from **RelativeBasePath** to **Path**. This parameter was added in PowerShell 7.4. diff --git a/reference/7.5/Microsoft.PowerShell.Utility/ConvertTo-Json.md b/reference/7.5/Microsoft.PowerShell.Utility/ConvertTo-Json.md index 2c62266cdfee..951f4d34bbc5 100644 --- a/reference/7.5/Microsoft.PowerShell.Utility/ConvertTo-Json.md +++ b/reference/7.5/Microsoft.PowerShell.Utility/ConvertTo-Json.md @@ -83,8 +83,8 @@ Get-Date | ConvertTo-Json; Get-Date | ConvertTo-Json -AsArray ] ``` -This example shows the output from `ConvertTo-Json` cmdlet with and without the **AsArray** switch -parameter. You can see the second portion of the output is wrapped in array brackets. +This example shows the output from the `ConvertTo-Json` cmdlet with and without the **AsArray** +`[switch]` parameter. You can see the second portion of the output is wrapped in array brackets. ### Example 3 diff --git a/reference/7.5/Microsoft.PowerShell.Utility/Show-Command.md b/reference/7.5/Microsoft.PowerShell.Utility/Show-Command.md index 5b9d05cdf239..c64913da5b0a 100644 --- a/reference/7.5/Microsoft.PowerShell.Utility/Show-Command.md +++ b/reference/7.5/Microsoft.PowerShell.Utility/Show-Command.md @@ -37,10 +37,10 @@ all installed modules. To find the commands in a module, select the module from drop-down list. To select a command, click the command name. To use the command window, select a command, either by using the Name or by clicking the command -name in the **Commands** list. Each parameter set is displayed on a separate tab. Asterisks indicate -the mandatory parameters. To enter values for a parameter, type the value in the text box or select -the value from the drop-down box. To add a switch parameter, click to select the parameter check -box. +name in the **Commands** list. Each parameter set is displayed on a separate tab. Asterisks +indicate the mandatory parameters. To enter values for a parameter, type the value in the text box +or select the value from the drop-down box. To add a `[switch]` parameter, click to select the +parameter check box. When you're ready, you can click **Copy** to copy the command that you've created to the clipboard or click **Run** to run the command. You can also use the **PassThru** parameter to return the diff --git a/reference/7.6/CimCmdlets/New-CimSession.md b/reference/7.6/CimCmdlets/New-CimSession.md index 14b5ed7bd13c..1d56932755b9 100644 --- a/reference/7.6/CimCmdlets/New-CimSession.md +++ b/reference/7.6/CimCmdlets/New-CimSession.md @@ -333,8 +333,8 @@ By default, the `New-CimSession` cmdlet establishes a connection with a remote W endpoint for two reasons: to verify that the remote server is listening on the port number that is specified using the **Port** parameter, and to verify the specified account credentials. The verification is accomplished using a standard WS-Identity operation. You can add the -**SkipTestConnection** switch parameter if the remote WS-Management endpoint cannot use WS-Identify, -or to reduce some data transmission time. +**SkipTestConnection** `[switch]` parameter if the remote WS-Management endpoint cannot use +WS-Identify, or to reduce some data transmission time. ```yaml Type: System.Management.Automation.SwitchParameter diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Command_Syntax.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Command_Syntax.md index 9cddeb993df0..e00f94f9b616 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Command_Syntax.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Command_Syntax.md @@ -198,19 +198,18 @@ The syntax diagrams use the following symbols: - Parameters with no values Some parameters don't accept input, so they don't have a parameter value. - Parameters without values are _switch parameters_. Switch parameters are used - like boolean values. They default to `$false`. When you use a switch - parameter, the value is set to `$true`. + Parameters without values are _`[switch]` parameters_. `[switch]` parameters + are used like boolean values. They default to `$false`. When you use a + `[switch]` parameter, the value is set to `$true`. - For example, the **ListImported** parameter of `Get-Command` is a switch - parameter. When you use the **ListImported** parameter, the cmdlet return + For example, the **ListImported** parameter of `Get-Command` is a `[switch]` + parameter. When you use the **ListImported** parameter, the cmdlet returns only commands that were imported from modules in the current session. ```Syntax Get-Command [-ListImported] ``` - - Brackets `[ ]` around parameters indicate optional items. A parameter and its value can be optional. For example, the **CommandType** parameter of `Get-Command` and its value are enclosed in brackets because they're both diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Functions.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Functions.md index 125cf409748d..174420c52314 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Functions.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Functions.md @@ -263,7 +263,7 @@ For more information about the standard PowerShell verbs, see ## Functions with parameters You can use parameters with functions, including named parameters, positional -parameters, switch parameters, and dynamic parameters. For more information +parameters, `[switch]` parameters, and dynamic parameters. For more information about dynamic parameters in functions, see [about_Functions_Advanced_Parameters][09]. @@ -403,13 +403,12 @@ Get-Extension myTextFile myTextFile.txt ``` -### Switch parameters +### `[switch]` parameters A switch is a parameter that doesn't require a value. Instead, you type the -function name followed by the name of the switch parameter. +function name followed by the name of the `[switch]` parameter. -To define a switch parameter, specify the type `[switch]` before the parameter -name, as shown in the following example: +The following example shows how you define a `[switch]` parameter: ```powershell function Switch-Item { @@ -419,8 +418,9 @@ function Switch-Item { } ``` -When you type the `On` switch parameter after the function name, the function -displays `Switch on`. Without the switch parameter, it displays `Switch off`. +When you type the `On` `[switch]` parameter after the function name, the +function displays `Switch on`. Without the `[switch]` parameter, it displays +`Switch off`. ```powershell Switch-Item -On diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md index 337bc79e27b5..e1502be39acb 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Parameters_Default_Values.md @@ -104,8 +104,8 @@ $PSDefaultParameterValues = @{ ``` The cmdlet and parameter names can contain wildcard characters. Use `$true` and -`$false` to set values for switch parameters, such as **Verbose**. This example -sets the common parameter **Verbose** to `$true` for all commands. +`$false` to set values for `[switch]` parameters, such as **Verbose**. This +example sets the common parameter **Verbose** to `$true` for all commands. ```powershell $PSDefaultParameterValues = @{'*:Verbose'=$true} @@ -162,9 +162,9 @@ You can use a scriptblock to specify different default values for a parameter under different conditions. PowerShell evaluates the scriptblock and uses the result as the default parameter value. -The `Format-Table:AutoSize` key sets that switch parameter to a default value -of `$true` The `if` statement contains a condition that the `$Host.Name` must -be `ConsoleHost`. +The `Format-Table:AutoSize` key sets that `[switch]` parameter to a default +value of `$true`. The `if` statement contains a condition that the `$Host.Name` +must be `ConsoleHost`. ```powershell $PSDefaultParameterValues = @{ diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md index 992d90e2a828..46b1edad6d18 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_PowerShell_Editions.md @@ -198,8 +198,8 @@ Get-Module -ListAvailable BitsTransfer # No output ``` -In both cases, the `-SkipEditionCheck` switch parameter can be used to override -this behavior: +In both cases, the `-SkipEditionCheck` `[switch]` parameter can be used to +override this behavior: ```powershell Get-Module -ListAvailable -SkipEditionCheck BitsTransfer diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Pwsh.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Pwsh.md index 1e38805dd44a..4be59a6cda73 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Pwsh.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Pwsh.md @@ -69,15 +69,15 @@ and any parameters. File must be the last parameter in the command, because all characters typed after the File parameter name are interpreted as the script filepath followed by the script parameters. -Typically, the switch parameters of a script are either included or omitted. -For example, the following command uses the **All** parameter of the +Typically, the `[switch]` parameters of a script are either included or +omitted. For example, the following command uses the **All** parameter of the `Get-Script.ps1` script file: `-File .\Get-Script.ps1 -All` -In rare cases, you might need to provide a **Boolean** value for a switch -parameter. To provide a **Boolean** value for a switch parameter in the value -of the **File** parameter, Use the parameter normally followed immediately by a -colon and the boolean value, such as the following: -`-File .\Get-Script.ps1 -All:$false`. +In rare cases, you might need to provide a **Boolean** value for a `[switch]` +parameter. To provide a **Boolean** value for a `[switch]` parameter in the +value of the **File** parameter, use the parameter normally followed +immediately by a colon and the boolean value, such as the following: `-File +.\Get-Script.ps1 -All:$false`. Parameters passed to the script are passed as literal strings, after interpretation by the current shell. For example, if you are in `cmd.exe` and diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Requires.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Requires.md index f29aa723600c..be32ef1c7756 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Requires.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Requires.md @@ -183,11 +183,11 @@ For example: #### -RunAsAdministrator -When this switch parameter is added to your `#Requires` statement, it specifies -that the PowerShell session in which you're running the script must be started -with elevated user rights. The **RunAsAdministrator** parameter is ignored on a -non-Windows operating system. The **RunAsAdministrator** parameter was -introduced in PowerShell 4.0. +When this `[switch]` parameter is added to your `#Requires` statement, it +specifies that the PowerShell session in which you're running the script must +be started with elevated user rights. The **RunAsAdministrator** parameter is +ignored on a non-Windows operating system. The **RunAsAdministrator** parameter +was introduced in PowerShell 4.0. For example: diff --git a/reference/7.6/Microsoft.PowerShell.Core/About/about_Splatting.md b/reference/7.6/Microsoft.PowerShell.Core/About/about_Splatting.md index d568b15ea19e..56603090cfb2 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/About/about_Splatting.md +++ b/reference/7.6/Microsoft.PowerShell.Core/About/about_Splatting.md @@ -52,7 +52,7 @@ defining a parameter in a command. ## Splatting with hash tables Use a hash table to splat parameter name and value pairs. You can use this -format for all parameter types, including positional and switch parameters. +format for all parameter types, including positional and `[switch]` parameters. Positional parameters must be assigned by name. The following examples compare two `Copy-Item` commands that copy the Test.txt @@ -71,7 +71,7 @@ table of parameter-name and parameter-value pairs and stores it in the variable in a command with splatting. The At symbol (`@HashArguments`) replaces the dollar sign (`$HashArguments`) in the command. -To provide a value for the **WhatIf** switch parameter, use `$true` or +To provide a value for the **WhatIf** `[switch]` parameter, use `$true` or `$false`. ```powershell diff --git a/reference/7.6/Microsoft.PowerShell.Core/Disable-PSRemoting.md b/reference/7.6/Microsoft.PowerShell.Core/Disable-PSRemoting.md index 37d7dfc9efae..5f93d0c8a5de 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/Disable-PSRemoting.md +++ b/reference/7.6/Microsoft.PowerShell.Core/Disable-PSRemoting.md @@ -235,7 +235,7 @@ A loopback connection is created when the following conditions are met: - The computer name to connect to is 'localhost'. - No credentials are passed in. Current logged in user (implicit credentials) is used for the connection. -- The **EnableNetworkAccess** switch parameter is used. +- The **EnableNetworkAccess** `[switch]` parameter is used. For more information on loopback connections, see [New-PSSession](New-PSSession.md) document. diff --git a/reference/7.6/Microsoft.PowerShell.Core/Get-Help.md b/reference/7.6/Microsoft.PowerShell.Core/Get-Help.md index 54ff838f08ee..936e1d44149c 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/Get-Help.md +++ b/reference/7.6/Microsoft.PowerShell.Core/Get-Help.md @@ -191,7 +191,7 @@ Get-Help Format-Table -Parameter GroupBy ``` The **Examples** parameter displays the help file's **NAME** and **SYNOPSIS** sections, and all the -Examples. You can't specify an Example number because the **Examples** parameter is a switch +Examples. You can't specify an Example number because the **Examples** parameter is a `[switch]` parameter. The **Parameter** parameter displays only the descriptions of the specified parameters. If you diff --git a/reference/7.6/Microsoft.PowerShell.Core/Where-Object.md b/reference/7.6/Microsoft.PowerShell.Core/Where-Object.md index 4c2ee64c9ae5..48e8fc41be03 100644 --- a/reference/7.6/Microsoft.PowerShell.Core/Where-Object.md +++ b/reference/7.6/Microsoft.PowerShell.Core/Where-Object.md @@ -263,9 +263,9 @@ command. All PowerShell comparison operators are valid in the scriptblock format. For more information, see [about_Comparison_Operators](./About/about_Comparison_Operators.md). -- **Simplified syntax**. To enable the simiplified syntax, `Where-Object` includes 31 switch +- **Simplified syntax**. To enable the simplified syntax, `Where-Object` includes 31 `[switch]` parameters that represent the comparison operators. The simplified syntax is easier to read and - write than the scriptblock syntax. You can combine one of the switch parameters with the + write than the scriptblock syntax. You can combine one of the `[switch]` parameters with the **Property** and **Value** parameters to create a command that filters objects based on the values of their properties. @@ -278,7 +278,7 @@ command. As shown in the example, the parameter names **Property** and **Value** are optional. The **Property** parameter is a positional parameter mapped to position `0`. The **Value** parameter - is a positional parameter mapped to position `1`. The switch parameter, used to specify the + is a positional parameter mapped to position `1`. The `[switch]` parameter, used to specify the comparison, can be used in any position. The simplified syntax was introduced in Windows PowerShell 3.0. For more information, see diff --git a/reference/7.6/Microsoft.PowerShell.Management/Resolve-Path.md b/reference/7.6/Microsoft.PowerShell.Management/Resolve-Path.md index 4e76b97dc210..88e138326cb4 100644 --- a/reference/7.6/Microsoft.PowerShell.Management/Resolve-Path.md +++ b/reference/7.6/Microsoft.PowerShell.Management/Resolve-Path.md @@ -113,8 +113,8 @@ Resolve-Path -LiteralPath 'test[xml]' ### Example 7: Resolve a path relative to another folder This example uses the **RelativeBasePath** parameter to resolve the path of the `pwsh` executable -relative to `$Env:TEMP`. When the command includes the **Relative** switch parameter, it returns a -**String** representing the relative path from `$Env:TEMP` to the `pwsh` executable. +relative to `$Env:TEMP`. When the command includes the **Relative** `[switch]` parameter, it +returns a **String** representing the relative path from `$Env:TEMP` to the `pwsh` executable. ```powershell $ExecutablePath = Get-Command -Name pwsh | Select-Object -ExpandProperty Source @@ -266,7 +266,7 @@ Accept wildcard characters: False Specifies a path to resolve the relative path from. When you use this parameter, the cmdlet returns the **System.Management.Automation.PathInfo** object for the resolved path. -When you use this parameter with the **Relative** switch parameter, the cmdlet returns a string +When you use this parameter with the **Relative** `[switch]` parameter, the cmdlet returns a string representing the relative path from **RelativeBasePath** to **Path**. This parameter was added in PowerShell 7.4. diff --git a/reference/7.6/Microsoft.PowerShell.Utility/ConvertTo-Json.md b/reference/7.6/Microsoft.PowerShell.Utility/ConvertTo-Json.md index f99c04183d81..d3a20055df71 100644 --- a/reference/7.6/Microsoft.PowerShell.Utility/ConvertTo-Json.md +++ b/reference/7.6/Microsoft.PowerShell.Utility/ConvertTo-Json.md @@ -84,8 +84,8 @@ Get-Date | ConvertTo-Json; Get-Date | ConvertTo-Json -AsArray ] ``` -This example shows the output from `ConvertTo-Json` cmdlet with and without the **AsArray** switch -parameter. You can see the second portion of the output is wrapped in array brackets. +This example shows the output from the `ConvertTo-Json` cmdlet with and without the **AsArray** +`[switch]` parameter. You can see the second portion of the output is wrapped in array brackets. ### Example 3 diff --git a/reference/7.6/Microsoft.PowerShell.Utility/Show-Command.md b/reference/7.6/Microsoft.PowerShell.Utility/Show-Command.md index 2f74d00481fa..4e1a97570ab3 100644 --- a/reference/7.6/Microsoft.PowerShell.Utility/Show-Command.md +++ b/reference/7.6/Microsoft.PowerShell.Utility/Show-Command.md @@ -37,10 +37,10 @@ all installed modules. To find the commands in a module, select the module from drop-down list. To select a command, click the command name. To use the command window, select a command, either by using the Name or by clicking the command -name in the **Commands** list. Each parameter set is displayed on a separate tab. Asterisks indicate -the mandatory parameters. To enter values for a parameter, type the value in the text box or select -the value from the drop-down box. To add a switch parameter, click to select the parameter check -box. +name in the **Commands** list. Each parameter set is displayed on a separate tab. Asterisks +indicate the mandatory parameters. To enter values for a parameter, type the value in the text box +or select the value from the drop-down box. To add a `[switch]` parameter, click to select the +parameter check box. When you're ready, you can click **Copy** to copy the command that you've created to the clipboard or click **Run** to run the command. You can also use the **PassThru** parameter to return the