Skip to content

Commit 1ad25ce

Browse files
authored
Fixes #10888 - Clarify usefulness of --% (#10900)
* Fix broken links * Clarify usefulness of --%
1 parent e4fcb27 commit 1ad25ce

File tree

10 files changed

+76
-86
lines changed

10 files changed

+76
-86
lines changed

reference/5.1/Microsoft.PowerShell.Core/About/about_Parsing.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: Describes how PowerShell parses commands.
33
Locale: en-US
4-
ms.date: 02/27/2023
4+
ms.date: 02/26/2024
55
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_parsing?view=powershell-5.1&WT.mc_id=ps-gethelp
66
schema: 2.0.0
77
title: about Parsing
@@ -272,7 +272,8 @@ Beginning in PowerShell 3.0, you can use the _stop-parsing_ (`--%`) token to
272272
stop PowerShell from interpreting input as PowerShell commands or expressions.
273273

274274
> [!NOTE]
275-
> The stop-parsing token is only intended for use on Windows platforms.
275+
> The stop-parsing token is only intended for use native commands on Windows
276+
> platforms.
276277
277278
When calling a native command, place the stop-parsing token before the program
278279
arguments. This technique is much easier than using escape characters to
@@ -317,8 +318,9 @@ PS> cmd /c --% echo "a|b"
317318
```
318319

319320
> [!NOTE]
320-
> Some commands on Windows systems are implemented as a Windows batch file. For
321-
> example, that `az` command for Azure CLI is a Windows batch file.
321+
> The stop-parsing token isn't needed when using PowerShell cmdlets. However,
322+
> it could be useful to pass arguments to a PowerShell function that is
323+
> designed to call a native command with those arguments.
322324
323325
### Passing arguments that contain quote characters
324326

reference/5.1/Microsoft.PowerShell.Core/About/about_Special_Characters.md

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: Describes the special character sequences that control how PowerShell interprets the next characters in the sequence.
33
Locale: en-US
4-
ms.date: 01/11/2023
4+
ms.date: 02/23/2024
55
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_special_characters?view=powershell-5.1&WT.mc_id=ps-gethelp
66
schema: 2.0.0
77
title: about Special Characters
@@ -225,24 +225,20 @@ PowerShell sends the following string to `Icacls`.
225225
X:\VMS /grant Dom\HVAdmin:(CI)(OI)F
226226
```
227227

228-
Here is another example. The **showArgs** function outputs the values passed to
229-
it. In this example, we pass the variable named `$HOME` to the function twice.
228+
In this second example, we pass the variable `$HOME` to the `cmd.exe /c echo`
229+
command twice.
230230

231231
```powershell
232-
function showArgs {
233-
"`$args = " + ($args -join '|')
234-
}
235-
236-
showArgs $HOME --% $HOME
232+
cmd.exe /c echo $HOME --% $HOME
237233
```
238234

239-
You can see in the output that, for the first parameter, the variable `$HOME`
240-
is interpreted by PowerShell so that the value of the variable is passed to the
241-
function. The second use of `$HOME` comes after the stop-parsing token, so the
242-
string "$HOME" is passed to the function without interpretation.
235+
The output shows that the first instance of `$HOME` is interpreted by
236+
PowerShell so that the value of the variable is passed to `cmd`. The second
237+
instance of `$HOME` comes after the stop-parsing token, so it is passed as a
238+
literal string.
243239

244240
```Output
245-
$args = C:\Users\username|--%|$HOME
241+
C:\Users\username $HOME
246242
```
247243

248244
For more information about the stop-parsing token, see [about_Parsing][02].

reference/7.2/Microsoft.PowerShell.Core/About/about_Parsing.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: Describes how PowerShell parses commands.
33
Locale: en-US
4-
ms.date: 02/27/2023
4+
ms.date: 02/26/2024
55
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_parsing?view=powershell-7.2&WT.mc_id=ps-gethelp
66
schema: 2.0.0
77
title: about Parsing
@@ -272,7 +272,8 @@ Beginning in PowerShell 3.0, you can use the _stop-parsing_ (`--%`) token to
272272
stop PowerShell from interpreting input as PowerShell commands or expressions.
273273

274274
> [!NOTE]
275-
> The stop-parsing token is only intended for use on Windows platforms.
275+
> The stop-parsing token is only intended for use native commands on Windows
276+
> platforms.
276277
277278
When calling a native command, place the stop-parsing token before the program
278279
arguments. This technique is much easier than using escape characters to
@@ -317,8 +318,9 @@ PS> cmd /c --% echo "a|b"
317318
```
318319

319320
> [!NOTE]
320-
> Some commands on Windows systems are implemented as a Windows batch file. For
321-
> example, that `az` command for Azure CLI is a Windows batch file.
321+
> The stop-parsing token isn't needed when using PowerShell cmdlets. However,
322+
> it could be useful to pass arguments to a PowerShell function that is
323+
> designed to call a native command with those arguments.
322324
323325
### Passing arguments that contain quote characters
324326

reference/7.2/Microsoft.PowerShell.Core/About/about_Special_Characters.md

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: Describes the special character sequences that control how PowerShell interprets the next characters in the sequence.
33
Locale: en-US
4-
ms.date: 01/11/2023
4+
ms.date: 02/23/2024
55
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_special_characters?view=powershell-7.2&WT.mc_id=ps-gethelp
66
schema: 2.0.0
77
title: about Special Characters
@@ -273,24 +273,20 @@ PowerShell sends the following string to `Icacls`.
273273
X:\VMS /grant Dom\HVAdmin:(CI)(OI)F
274274
```
275275

276-
Here is another example. The **showArgs** function outputs the values passed to
277-
it. In this example, we pass the variable named `$HOME` to the function twice.
276+
In this second example, we pass the variable `$HOME` to the `cmd.exe /c echo`
277+
command twice.
278278

279279
```powershell
280-
function showArgs {
281-
"`$args = " + ($args -join '|')
282-
}
283-
284-
showArgs $HOME --% $HOME
280+
cmd.exe /c echo $HOME --% $HOME
285281
```
286282

287-
You can see in the output that, for the first parameter, the variable `$HOME`
288-
is interpreted by PowerShell so that the value of the variable is passed to the
289-
function. The second use of `$HOME` comes after the stop-parsing token, so the
290-
string "$HOME" is passed to the function without interpretation.
283+
The output shows that the first instance of `$HOME` is interpreted by
284+
PowerShell so that the value of the variable is passed to `cmd`. The second
285+
instance of `$HOME` comes after the stop-parsing token, so it is passed as a
286+
literal string.
291287

292288
```Output
293-
$args = C:\Users\username|--%|$HOME
289+
C:\Users\username $HOME
294290
```
295291

296292
For more information about the stop-parsing token, see [about_Parsing][02].

reference/7.3/Microsoft.PowerShell.Core/About/about_Parsing.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: Describes how PowerShell parses commands.
33
Locale: en-US
4-
ms.date: 02/27/2023
4+
ms.date: 02/26/2024
55
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_parsing?view=powershell-7.3&WT.mc_id=ps-gethelp
66
schema: 2.0.0
77
title: about Parsing
@@ -272,7 +272,8 @@ Beginning in PowerShell 3.0, you can use the _stop-parsing_ (`--%`) token to
272272
stop PowerShell from interpreting input as PowerShell commands or expressions.
273273

274274
> [!NOTE]
275-
> The stop-parsing token is only intended for use on Windows platforms.
275+
> The stop-parsing token is only intended for use native commands on Windows
276+
> platforms.
276277
277278
When calling a native command, place the stop-parsing token before the program
278279
arguments. This technique is much easier than using escape characters to
@@ -317,8 +318,9 @@ PS> cmd /c --% echo "a|b"
317318
```
318319

319320
> [!NOTE]
320-
> Some commands on Windows systems are implemented as a Windows batch file. For
321-
> example, that `az` command for Azure CLI is a Windows batch file.
321+
> The stop-parsing token isn't needed when using PowerShell cmdlets. However,
322+
> it could be useful to pass arguments to a PowerShell function that is
323+
> designed to call a native command with those arguments.
322324
323325
### Passing arguments that contain quote characters
324326

reference/7.3/Microsoft.PowerShell.Core/About/about_Special_Characters.md

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: Describes the special character sequences that control how PowerShell interprets the next characters in the sequence.
33
Locale: en-US
4-
ms.date: 01/11/2023
4+
ms.date: 02/23/2024
55
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_special_characters?view=powershell-7.3&WT.mc_id=ps-gethelp
66
schema: 2.0.0
77
title: about Special Characters
@@ -195,7 +195,7 @@ This example outputs the **up down arrow** (↕) symbol.
195195
## Vertical tab (`v)
196196

197197
The vertical tab (`` `v ``) character advances to the next vertical tab stop
198-
and writes the remaining output at that point. The rendering of the
198+
and writes the remaining output at that point. The rendering of the the
199199
vertical tab is device and terminal dependent.
200200

201201
```powershell
@@ -273,24 +273,20 @@ PowerShell sends the following string to `Icacls`.
273273
X:\VMS /grant Dom\HVAdmin:(CI)(OI)F
274274
```
275275

276-
Here is another example. The **showArgs** function outputs the values passed to
277-
it. In this example, we pass the variable named `$HOME` to the function twice.
276+
In this second example, we pass the variable `$HOME` to the `cmd.exe /c echo`
277+
command twice.
278278

279279
```powershell
280-
function showArgs {
281-
"`$args = " + ($args -join '|')
282-
}
283-
284-
showArgs $HOME --% $HOME
280+
cmd.exe /c echo $HOME --% $HOME
285281
```
286282

287-
You can see in the output that, for the first parameter, the variable `$HOME`
288-
is interpreted by PowerShell so that the value of the variable is passed to the
289-
function. The second use of `$HOME` comes after the stop-parsing token, so the
290-
string "$HOME" is passed to the function without interpretation.
283+
The output shows that the first instance of `$HOME` is interpreted by
284+
PowerShell so that the value of the variable is passed to `cmd`. The second
285+
instance of `$HOME` comes after the stop-parsing token, so it is passed as a
286+
literal string.
291287

292288
```Output
293-
$args = C:\Users\username|--%|$HOME
289+
C:\Users\username $HOME
294290
```
295291

296292
For more information about the stop-parsing token, see [about_Parsing][02].

reference/7.4/Microsoft.PowerShell.Core/About/about_Parsing.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: Describes how PowerShell parses commands.
33
Locale: en-US
4-
ms.date: 02/27/2023
4+
ms.date: 02/26/2024
55
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_parsing?view=powershell-7.4&WT.mc_id=ps-gethelp
66
schema: 2.0.0
77
title: about Parsing
@@ -272,7 +272,8 @@ Beginning in PowerShell 3.0, you can use the _stop-parsing_ (`--%`) token to
272272
stop PowerShell from interpreting input as PowerShell commands or expressions.
273273

274274
> [!NOTE]
275-
> The stop-parsing token is only intended for use on Windows platforms.
275+
> The stop-parsing token is only intended for use native commands on Windows
276+
> platforms.
276277
277278
When calling a native command, place the stop-parsing token before the program
278279
arguments. This technique is much easier than using escape characters to
@@ -317,8 +318,9 @@ PS> cmd /c --% echo "a|b"
317318
```
318319

319320
> [!NOTE]
320-
> Some commands on Windows systems are implemented as a Windows batch file. For
321-
> example, that `az` command for Azure CLI is a Windows batch file.
321+
> The stop-parsing token isn't needed when using PowerShell cmdlets. However,
322+
> it could be useful to pass arguments to a PowerShell function that is
323+
> designed to call a native command with those arguments.
322324
323325
### Passing arguments that contain quote characters
324326

reference/7.4/Microsoft.PowerShell.Core/About/about_Special_Characters.md

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: Describes the special character sequences that control how PowerShell interprets the next characters in the sequence.
33
Locale: en-US
4-
ms.date: 01/11/2023
4+
ms.date: 02/23/2024
55
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_special_characters?view=powershell-7.4&WT.mc_id=ps-gethelp
66
schema: 2.0.0
77
title: about Special Characters
@@ -273,24 +273,20 @@ PowerShell sends the following string to `Icacls`.
273273
X:\VMS /grant Dom\HVAdmin:(CI)(OI)F
274274
```
275275

276-
Here is another example. The **showArgs** function outputs the values passed to
277-
it. In this example, we pass the variable named `$HOME` to the function twice.
276+
In this second example, we pass the variable `$HOME` to the `cmd.exe /c echo`
277+
command twice.
278278

279279
```powershell
280-
function showArgs {
281-
"`$args = " + ($args -join '|')
282-
}
283-
284-
showArgs $HOME --% $HOME
280+
cmd.exe /c echo $HOME --% $HOME
285281
```
286282

287-
You can see in the output that, for the first parameter, the variable `$HOME`
288-
is interpreted by PowerShell so that the value of the variable is passed to the
289-
function. The second use of `$HOME` comes after the stop-parsing token, so the
290-
string "$HOME" is passed to the function without interpretation.
283+
The output shows that the first instance of `$HOME` is interpreted by
284+
PowerShell so that the value of the variable is passed to `cmd`. The second
285+
instance of `$HOME` comes after the stop-parsing token, so it is passed as a
286+
literal string.
291287

292288
```Output
293-
$args = C:\Users\username|--%|$HOME
289+
C:\Users\username $HOME
294290
```
295291

296292
For more information about the stop-parsing token, see [about_Parsing][02].

reference/7.5/Microsoft.PowerShell.Core/About/about_Parsing.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: Describes how PowerShell parses commands.
33
Locale: en-US
4-
ms.date: 02/27/2023
4+
ms.date: 02/26/2024
55
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_parsing?view=powershell-7.5&WT.mc_id=ps-gethelp
66
schema: 2.0.0
77
title: about Parsing
@@ -272,7 +272,8 @@ Beginning in PowerShell 3.0, you can use the _stop-parsing_ (`--%`) token to
272272
stop PowerShell from interpreting input as PowerShell commands or expressions.
273273

274274
> [!NOTE]
275-
> The stop-parsing token is only intended for use on Windows platforms.
275+
> The stop-parsing token is only intended for use native commands on Windows
276+
> platforms.
276277
277278
When calling a native command, place the stop-parsing token before the program
278279
arguments. This technique is much easier than using escape characters to
@@ -317,8 +318,9 @@ PS> cmd /c --% echo "a|b"
317318
```
318319

319320
> [!NOTE]
320-
> Some commands on Windows systems are implemented as a Windows batch file. For
321-
> example, that `az` command for Azure CLI is a Windows batch file.
321+
> The stop-parsing token isn't needed when using PowerShell cmdlets. However,
322+
> it could be useful to pass arguments to a PowerShell function that is
323+
> designed to call a native command with those arguments.
322324
323325
### Passing arguments that contain quote characters
324326

reference/7.5/Microsoft.PowerShell.Core/About/about_Special_Characters.md

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: Describes the special character sequences that control how PowerShell interprets the next characters in the sequence.
33
Locale: en-US
4-
ms.date: 01/11/2023
4+
ms.date: 02/23/2024
55
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_special_characters?view=powershell-7.5&WT.mc_id=ps-gethelp
66
schema: 2.0.0
77
title: about Special Characters
@@ -273,24 +273,20 @@ PowerShell sends the following string to `Icacls`.
273273
X:\VMS /grant Dom\HVAdmin:(CI)(OI)F
274274
```
275275

276-
Here is another example. The **showArgs** function outputs the values passed to
277-
it. In this example, we pass the variable named `$HOME` to the function twice.
276+
In this second example, we pass the variable `$HOME` to the `cmd.exe /c echo`
277+
command twice.
278278

279279
```powershell
280-
function showArgs {
281-
"`$args = " + ($args -join '|')
282-
}
283-
284-
showArgs $HOME --% $HOME
280+
cmd.exe /c echo $HOME --% $HOME
285281
```
286282

287-
You can see in the output that, for the first parameter, the variable `$HOME`
288-
is interpreted by PowerShell so that the value of the variable is passed to the
289-
function. The second use of `$HOME` comes after the stop-parsing token, so the
290-
string "$HOME" is passed to the function without interpretation.
283+
The output shows that the first instance of `$HOME` is interpreted by
284+
PowerShell so that the value of the variable is passed to `cmd`. The second
285+
instance of `$HOME` comes after the stop-parsing token, so it is passed as a
286+
literal string.
291287

292288
```Output
293-
$args = C:\Users\username|--%|$HOME
289+
C:\Users\username $HOME
294290
```
295291

296292
For more information about the stop-parsing token, see [about_Parsing][02].

0 commit comments

Comments
 (0)