Skip to content

Commit 296cda0

Browse files
authored
Add info about end-of-parameters token (#8819)
1 parent 2ba2e7e commit 296cda0

File tree

11 files changed

+216
-49
lines changed

11 files changed

+216
-49
lines changed

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

Lines changed: 20 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: 09/07/2021
4+
ms.date: 05/16/2022
55
online version: https://docs.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
@@ -200,10 +200,11 @@ prevent PowerShell from misinterpreting the parentheses.
200200
icacls X:\VMS /grant Dom\HVAdmin:`(CI`)`(OI`)F
201201
```
202202

203-
### The stop-parsing token
203+
### The stop-parsing and end-of-parameters tokens
204204

205-
Beginning in PowerShell 3.0, you can use the stop-parsing token (`--%`) to
206-
stop PowerShell from interpreting input as PowerShell commands or expressions.
205+
Beginning in PowerShell 3.0, you can use the _stop-parsing_ (`--%`) and
206+
_end-of-parameters_ tokens (`--`) to stop PowerShell from interpreting input as
207+
PowerShell commands or expressions.
207208

208209
> [!NOTE]
209210
> The stop-parsing token is only intended for use on Windows platforms.
@@ -238,6 +239,21 @@ variable the token is passed through as-is.
238239
You cannot use stream redirection (like `>file.txt`) because they are passed
239240
verbatim as arguments to the target command.
240241

242+
The end-of-parameters token (`--`) indicates that all arguments following it
243+
are to be passed in their actual form as though double quotes were placed
244+
around them. For example, using `--` you can output the string `-InputObject`
245+
without using quotes or having it interpreted as a parameter:
246+
247+
```powershell
248+
Write-Output -- -InputObject
249+
```
250+
251+
```Output
252+
-InputObject
253+
```
254+
255+
This is a convention specified in the POSIX Shell and Utilities specification.
256+
241257
### Passing arguments that contain quote characters
242258

243259
Some native commands expect arguments that contain quote characters. Normally,

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

Lines changed: 23 additions & 5 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: 02/08/2021
4+
ms.date: 05/16/2022
55
online version: https://docs.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
@@ -44,11 +44,12 @@ PowerShell also has a special token to mark where you want parsing to stop. All
4444
characters that follow this token are used as literal values that aren't
4545
interpreted.
4646

47-
Special parsing token:
47+
Special parsing tokens:
4848

49-
| Sequence | Description |
50-
| -------- | ---------------------------------- |
51-
| `--%` | Stop parsing anything that follows |
49+
| Sequence | Description |
50+
| -------- | ------------------------------------------------------ |
51+
| `--` | Treat the remaining values as arguments not parameters |
52+
| `--%` | Stop parsing anything that follows |
5253

5354
## Null (`0)
5455

@@ -180,6 +181,23 @@ There is a vertical tab
180181
between the words.
181182
```
182183

184+
## The end-of-parameters token (`--`)
185+
186+
The end-of-parameters token (`--`) indicates that all arguments following it
187+
are to be passed in their actual form as though double quotes were placed
188+
around them. For example, using `--` you can output the string `-InputObject`
189+
without using quotes or having it interpreted as a parameter:
190+
191+
```powershell
192+
Write-Output -- -InputObject
193+
```
194+
195+
```Output
196+
-InputObject
197+
```
198+
199+
This is a convention specified in the POSIX Shell and Utilities specification.
200+
183201
## Stop-parsing token (--%)
184202

185203
The stop-parsing (`--%`) token prevents PowerShell from interpreting strings as

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

Lines changed: 20 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: 09/07/2021
4+
ms.date: 05/16/2022
55
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_parsing?view=powershell-7&WT.mc_id=ps-gethelp
66
schema: 2.0.0
77
title: about Parsing
@@ -200,10 +200,11 @@ prevent PowerShell from misinterpreting the parentheses.
200200
icacls X:\VMS /grant Dom\HVAdmin:`(CI`)`(OI`)F
201201
```
202202

203-
### The stop-parsing token
203+
### The stop-parsing and end-of-parameters tokens
204204

205-
Beginning in PowerShell 3.0, you can use the stop-parsing token (`--%`) to
206-
stop PowerShell from interpreting input as PowerShell commands or expressions.
205+
Beginning in PowerShell 3.0, you can use the _stop-parsing_ (`--%`) and
206+
_end-of-parameters_ tokens (`--`) to stop PowerShell from interpreting input as
207+
PowerShell commands or expressions.
207208

208209
> [!NOTE]
209210
> The stop-parsing token is only intended for use on Windows platforms.
@@ -238,6 +239,21 @@ variable the token is passed through as-is.
238239
You cannot use stream redirection (like `>file.txt`) because they are passed
239240
verbatim as arguments to the target command.
240241

242+
The end-of-parameters token (`--`) indicates that all arguments following it
243+
are to be passed in their actual form as though double quotes were placed
244+
around them. For example, using `--` you can output the string `-InputObject`
245+
without using quotes or having it interpreted as a parameter:
246+
247+
```powershell
248+
Write-Output -- -InputObject
249+
```
250+
251+
```Output
252+
-InputObject
253+
```
254+
255+
This is a convention specified in the POSIX Shell and Utilities specification.
256+
241257
### Passing arguments that contain quote characters
242258

243259
Some native commands expect arguments that contain quote characters. Normally,

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

Lines changed: 23 additions & 5 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: 02/08/2021
4+
ms.date: 05/16/2022
55
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_special_characters?view=powershell-7&WT.mc_id=ps-gethelp
66
schema: 2.0.0
77
title: about Special Characters
@@ -46,11 +46,12 @@ PowerShell also has a special token to mark where you want parsing to stop. All
4646
characters that follow this token are used as literal values that aren't
4747
interpreted.
4848

49-
Special parsing token:
49+
Special parsing tokens:
5050

51-
| Sequence | Description |
52-
| -------- | ---------------------------------- |
53-
| `--%` | Stop parsing anything that follows |
51+
| Sequence | Description |
52+
| -------- | ------------------------------------------------------ |
53+
| `--` | Treat the remaining values as arguments not parameters |
54+
| `--%` | Stop parsing anything that follows |
5455

5556
## Null (`0)
5657

@@ -222,6 +223,23 @@ There is a vertical tab
222223
between the words.
223224
```
224225

226+
## The end-of-parameters token (`--`)
227+
228+
The end-of-parameters token (`--`) indicates that all arguments following it
229+
are to be passed in their actual form as though double quotes were placed
230+
around them. For example, using `--` you can output the string `-InputObject`
231+
without using quotes or having it interpreted as a parameter:
232+
233+
```powershell
234+
Write-Output -- -InputObject
235+
```
236+
237+
```Output
238+
-InputObject
239+
```
240+
241+
This is a convention specified in the POSIX Shell and Utilities specification.
242+
225243
## Stop-parsing token (--%)
226244

227245
The stop-parsing (`--%`) token prevents PowerShell from interpreting strings as

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

Lines changed: 20 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: 09/07/2021
4+
ms.date: 05/16/2022
55
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_parsing?view=powershell-7.1&WT.mc_id=ps-gethelp
66
schema: 2.0.0
77
title: about Parsing
@@ -200,10 +200,11 @@ prevent PowerShell from misinterpreting the parentheses.
200200
icacls X:\VMS /grant Dom\HVAdmin:`(CI`)`(OI`)F
201201
```
202202

203-
### The stop-parsing token
203+
### The stop-parsing and end-of-parameters tokens
204204

205-
Beginning in PowerShell 3.0, you can use the stop-parsing token (`--%`) to
206-
stop PowerShell from interpreting input as PowerShell commands or expressions.
205+
Beginning in PowerShell 3.0, you can use the _stop-parsing_ (`--%`) and
206+
_end-of-parameters_ tokens (`--`) to stop PowerShell from interpreting input as
207+
PowerShell commands or expressions.
207208

208209
> [!NOTE]
209210
> The stop-parsing token is only intended for use on Windows platforms.
@@ -238,6 +239,21 @@ variable the token is passed through as-is.
238239
You cannot use stream redirection (like `>file.txt`) because they are passed
239240
verbatim as arguments to the target command.
240241

242+
The end-of-parameters token (`--`) indicates that all arguments following it
243+
are to be passed in their actual form as though double quotes were placed
244+
around them. For example, using `--` you can output the string `-InputObject`
245+
without using quotes or having it interpreted as a parameter:
246+
247+
```powershell
248+
Write-Output -- -InputObject
249+
```
250+
251+
```Output
252+
-InputObject
253+
```
254+
255+
This is a convention specified in the POSIX Shell and Utilities specification.
256+
241257
### Passing arguments that contain quote characters
242258

243259
Some native commands expect arguments that contain quote characters. Normally,

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

Lines changed: 23 additions & 5 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: 02/08/2021
4+
ms.date: 05/16/2022
55
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_special_characters?view=powershell-7.1&WT.mc_id=ps-gethelp
66
schema: 2.0.0
77
title: about Special Characters
@@ -46,11 +46,12 @@ PowerShell also has a special token to mark where you want parsing to stop. All
4646
characters that follow this token are used as literal values that aren't
4747
interpreted.
4848

49-
Special parsing token:
49+
Special parsing tokens:
5050

51-
| Sequence | Description |
52-
| -------- | ---------------------------------- |
53-
| `--%` | Stop parsing anything that follows |
51+
| Sequence | Description |
52+
| -------- | ------------------------------------------------------ |
53+
| `--` | Treat the remaining values as arguments not parameters |
54+
| `--%` | Stop parsing anything that follows |
5455

5556
## Null (`0)
5657

@@ -222,6 +223,23 @@ There is a vertical tab
222223
between the words.
223224
```
224225

226+
## The end-of-parameters token (`--`)
227+
228+
The end-of-parameters token (`--`) indicates that all arguments following it
229+
are to be passed in their actual form as though double quotes were placed
230+
around them. For example, using `--` you can output the string `-InputObject`
231+
without using quotes or having it interpreted as a parameter:
232+
233+
```powershell
234+
Write-Output -- -InputObject
235+
```
236+
237+
```Output
238+
-InputObject
239+
```
240+
241+
This is a convention specified in the POSIX Shell and Utilities specification.
242+
225243
## Stop-parsing token (--%)
226244

227245
The stop-parsing (`--%`) token prevents PowerShell from interpreting strings as

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

Lines changed: 20 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: 09/07/2021
4+
ms.date: 05/16/2022
55
online version: https://docs.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
@@ -200,10 +200,11 @@ prevent PowerShell from misinterpreting the parentheses.
200200
icacls X:\VMS /grant Dom\HVAdmin:`(CI`)`(OI`)F
201201
```
202202

203-
### The stop-parsing token
203+
### The stop-parsing and end-of-parameters tokens
204204

205-
Beginning in PowerShell 3.0, you can use the stop-parsing token (`--%`) to
206-
stop PowerShell from interpreting input as PowerShell commands or expressions.
205+
Beginning in PowerShell 3.0, you can use the _stop-parsing_ (`--%`) and
206+
_end-of-parameters_ tokens (`--`) to stop PowerShell from interpreting input as
207+
PowerShell commands or expressions.
207208

208209
> [!NOTE]
209210
> The stop-parsing token is only intended for use on Windows platforms.
@@ -238,6 +239,21 @@ variable the token is passed through as-is.
238239
You cannot use stream redirection (like `>file.txt`) because they are passed
239240
verbatim as arguments to the target command.
240241

242+
The end-of-parameters token (`--`) indicates that all arguments following it
243+
are to be passed in their actual form as though double quotes were placed
244+
around them. For example, using `--` you can output the string `-InputObject`
245+
without using quotes or having it interpreted as a parameter:
246+
247+
```powershell
248+
Write-Output -- -InputObject
249+
```
250+
251+
```Output
252+
-InputObject
253+
```
254+
255+
This is a convention specified in the POSIX Shell and Utilities specification.
256+
241257
### Passing arguments that contain quote characters
242258

243259
Some native commands expect arguments that contain quote characters. Normally,

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

Lines changed: 23 additions & 5 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: 02/08/2021
4+
ms.date: 05/16/2022
55
online version: https://docs.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
@@ -46,11 +46,12 @@ PowerShell also has a special token to mark where you want parsing to stop. All
4646
characters that follow this token are used as literal values that aren't
4747
interpreted.
4848

49-
Special parsing token:
49+
Special parsing tokens:
5050

51-
| Sequence | Description |
52-
| -------- | ---------------------------------- |
53-
| `--%` | Stop parsing anything that follows |
51+
| Sequence | Description |
52+
| -------- | ------------------------------------------------------ |
53+
| `--` | Treat the remaining values as arguments not parameters |
54+
| `--%` | Stop parsing anything that follows |
5455

5556
## Null (`0)
5657

@@ -222,6 +223,23 @@ There is a vertical tab
222223
between the words.
223224
```
224225

226+
## The end-of-parameters token (`--`)
227+
228+
The end-of-parameters token (`--`) indicates that all arguments following it
229+
are to be passed in their actual form as though double quotes were placed
230+
around them. For example, using `--` you can output the string `-InputObject`
231+
without using quotes or having it interpreted as a parameter:
232+
233+
```powershell
234+
Write-Output -- -InputObject
235+
```
236+
237+
```Output
238+
-InputObject
239+
```
240+
241+
This is a convention specified in the POSIX Shell and Utilities specification.
242+
225243
## Stop-parsing token (--%)
226244

227245
The stop-parsing (`--%`) token prevents PowerShell from interpreting strings as

0 commit comments

Comments
 (0)