Skip to content

Commit

Permalink
Add info about end-of-parameters token (#8819)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdwheeler authored May 16, 2022
1 parent 2ba2e7e commit 296cda0
Show file tree
Hide file tree
Showing 11 changed files with 216 additions and 49 deletions.
24 changes: 20 additions & 4 deletions reference/5.1/Microsoft.PowerShell.Core/About/about_Parsing.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: Describes how PowerShell parses commands.
Locale: en-US
ms.date: 09/07/2021
ms.date: 05/16/2022
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_parsing?view=powershell-5.1&WT.mc_id=ps-gethelp
schema: 2.0.0
title: about Parsing
Expand Down Expand Up @@ -200,10 +200,11 @@ prevent PowerShell from misinterpreting the parentheses.
icacls X:\VMS /grant Dom\HVAdmin:`(CI`)`(OI`)F
```

### The stop-parsing token
### The stop-parsing and end-of-parameters tokens

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

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

The end-of-parameters token (`--`) indicates that all arguments following it
are to be passed in their actual form as though double quotes were placed
around them. For example, using `--` you can output the string `-InputObject`
without using quotes or having it interpreted as a parameter:

```powershell
Write-Output -- -InputObject
```

```Output
-InputObject
```

This is a convention specified in the POSIX Shell and Utilities specification.

### Passing arguments that contain quote characters

Some native commands expect arguments that contain quote characters. Normally,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: Describes the special character sequences that control how PowerShell interprets the next characters in the sequence.
Locale: en-US
ms.date: 02/08/2021
ms.date: 05/16/2022
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_special_characters?view=powershell-5.1&WT.mc_id=ps-gethelp
schema: 2.0.0
title: about Special Characters
Expand Down Expand Up @@ -44,11 +44,12 @@ PowerShell also has a special token to mark where you want parsing to stop. All
characters that follow this token are used as literal values that aren't
interpreted.

Special parsing token:
Special parsing tokens:

| Sequence | Description |
| -------- | ---------------------------------- |
| `--%` | Stop parsing anything that follows |
| Sequence | Description |
| -------- | ------------------------------------------------------ |
| `--` | Treat the remaining values as arguments not parameters |
| `--%` | Stop parsing anything that follows |

## Null (`0)

Expand Down Expand Up @@ -180,6 +181,23 @@ There is a vertical tab
between the words.
```

## The end-of-parameters token (`--`)

The end-of-parameters token (`--`) indicates that all arguments following it
are to be passed in their actual form as though double quotes were placed
around them. For example, using `--` you can output the string `-InputObject`
without using quotes or having it interpreted as a parameter:

```powershell
Write-Output -- -InputObject
```

```Output
-InputObject
```

This is a convention specified in the POSIX Shell and Utilities specification.

## Stop-parsing token (--%)

The stop-parsing (`--%`) token prevents PowerShell from interpreting strings as
Expand Down
24 changes: 20 additions & 4 deletions reference/7.0/Microsoft.PowerShell.Core/About/about_Parsing.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: Describes how PowerShell parses commands.
Locale: en-US
ms.date: 09/07/2021
ms.date: 05/16/2022
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_parsing?view=powershell-7&WT.mc_id=ps-gethelp
schema: 2.0.0
title: about Parsing
Expand Down Expand Up @@ -200,10 +200,11 @@ prevent PowerShell from misinterpreting the parentheses.
icacls X:\VMS /grant Dom\HVAdmin:`(CI`)`(OI`)F
```

### The stop-parsing token
### The stop-parsing and end-of-parameters tokens

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

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

The end-of-parameters token (`--`) indicates that all arguments following it
are to be passed in their actual form as though double quotes were placed
around them. For example, using `--` you can output the string `-InputObject`
without using quotes or having it interpreted as a parameter:

```powershell
Write-Output -- -InputObject
```

```Output
-InputObject
```

This is a convention specified in the POSIX Shell and Utilities specification.

### Passing arguments that contain quote characters

Some native commands expect arguments that contain quote characters. Normally,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: Describes the special character sequences that control how PowerShell interprets the next characters in the sequence.
Locale: en-US
ms.date: 02/08/2021
ms.date: 05/16/2022
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_special_characters?view=powershell-7&WT.mc_id=ps-gethelp
schema: 2.0.0
title: about Special Characters
Expand Down Expand Up @@ -46,11 +46,12 @@ PowerShell also has a special token to mark where you want parsing to stop. All
characters that follow this token are used as literal values that aren't
interpreted.

Special parsing token:
Special parsing tokens:

| Sequence | Description |
| -------- | ---------------------------------- |
| `--%` | Stop parsing anything that follows |
| Sequence | Description |
| -------- | ------------------------------------------------------ |
| `--` | Treat the remaining values as arguments not parameters |
| `--%` | Stop parsing anything that follows |

## Null (`0)

Expand Down Expand Up @@ -222,6 +223,23 @@ There is a vertical tab
between the words.
```

## The end-of-parameters token (`--`)

The end-of-parameters token (`--`) indicates that all arguments following it
are to be passed in their actual form as though double quotes were placed
around them. For example, using `--` you can output the string `-InputObject`
without using quotes or having it interpreted as a parameter:

```powershell
Write-Output -- -InputObject
```

```Output
-InputObject
```

This is a convention specified in the POSIX Shell and Utilities specification.

## Stop-parsing token (--%)

The stop-parsing (`--%`) token prevents PowerShell from interpreting strings as
Expand Down
24 changes: 20 additions & 4 deletions reference/7.1/Microsoft.PowerShell.Core/About/about_Parsing.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: Describes how PowerShell parses commands.
Locale: en-US
ms.date: 09/07/2021
ms.date: 05/16/2022
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_parsing?view=powershell-7.1&WT.mc_id=ps-gethelp
schema: 2.0.0
title: about Parsing
Expand Down Expand Up @@ -200,10 +200,11 @@ prevent PowerShell from misinterpreting the parentheses.
icacls X:\VMS /grant Dom\HVAdmin:`(CI`)`(OI`)F
```

### The stop-parsing token
### The stop-parsing and end-of-parameters tokens

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

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

The end-of-parameters token (`--`) indicates that all arguments following it
are to be passed in their actual form as though double quotes were placed
around them. For example, using `--` you can output the string `-InputObject`
without using quotes or having it interpreted as a parameter:

```powershell
Write-Output -- -InputObject
```

```Output
-InputObject
```

This is a convention specified in the POSIX Shell and Utilities specification.

### Passing arguments that contain quote characters

Some native commands expect arguments that contain quote characters. Normally,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: Describes the special character sequences that control how PowerShell interprets the next characters in the sequence.
Locale: en-US
ms.date: 02/08/2021
ms.date: 05/16/2022
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_special_characters?view=powershell-7.1&WT.mc_id=ps-gethelp
schema: 2.0.0
title: about Special Characters
Expand Down Expand Up @@ -46,11 +46,12 @@ PowerShell also has a special token to mark where you want parsing to stop. All
characters that follow this token are used as literal values that aren't
interpreted.

Special parsing token:
Special parsing tokens:

| Sequence | Description |
| -------- | ---------------------------------- |
| `--%` | Stop parsing anything that follows |
| Sequence | Description |
| -------- | ------------------------------------------------------ |
| `--` | Treat the remaining values as arguments not parameters |
| `--%` | Stop parsing anything that follows |

## Null (`0)

Expand Down Expand Up @@ -222,6 +223,23 @@ There is a vertical tab
between the words.
```

## The end-of-parameters token (`--`)

The end-of-parameters token (`--`) indicates that all arguments following it
are to be passed in their actual form as though double quotes were placed
around them. For example, using `--` you can output the string `-InputObject`
without using quotes or having it interpreted as a parameter:

```powershell
Write-Output -- -InputObject
```

```Output
-InputObject
```

This is a convention specified in the POSIX Shell and Utilities specification.

## Stop-parsing token (--%)

The stop-parsing (`--%`) token prevents PowerShell from interpreting strings as
Expand Down
24 changes: 20 additions & 4 deletions reference/7.2/Microsoft.PowerShell.Core/About/about_Parsing.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: Describes how PowerShell parses commands.
Locale: en-US
ms.date: 09/07/2021
ms.date: 05/16/2022
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_parsing?view=powershell-7.2&WT.mc_id=ps-gethelp
schema: 2.0.0
title: about Parsing
Expand Down Expand Up @@ -200,10 +200,11 @@ prevent PowerShell from misinterpreting the parentheses.
icacls X:\VMS /grant Dom\HVAdmin:`(CI`)`(OI`)F
```

### The stop-parsing token
### The stop-parsing and end-of-parameters tokens

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

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

The end-of-parameters token (`--`) indicates that all arguments following it
are to be passed in their actual form as though double quotes were placed
around them. For example, using `--` you can output the string `-InputObject`
without using quotes or having it interpreted as a parameter:

```powershell
Write-Output -- -InputObject
```

```Output
-InputObject
```

This is a convention specified in the POSIX Shell and Utilities specification.

### Passing arguments that contain quote characters

Some native commands expect arguments that contain quote characters. Normally,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: Describes the special character sequences that control how PowerShell interprets the next characters in the sequence.
Locale: en-US
ms.date: 02/08/2021
ms.date: 05/16/2022
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_special_characters?view=powershell-7.2&WT.mc_id=ps-gethelp
schema: 2.0.0
title: about Special Characters
Expand Down Expand Up @@ -46,11 +46,12 @@ PowerShell also has a special token to mark where you want parsing to stop. All
characters that follow this token are used as literal values that aren't
interpreted.

Special parsing token:
Special parsing tokens:

| Sequence | Description |
| -------- | ---------------------------------- |
| `--%` | Stop parsing anything that follows |
| Sequence | Description |
| -------- | ------------------------------------------------------ |
| `--` | Treat the remaining values as arguments not parameters |
| `--%` | Stop parsing anything that follows |

## Null (`0)

Expand Down Expand Up @@ -222,6 +223,23 @@ There is a vertical tab
between the words.
```

## The end-of-parameters token (`--`)

The end-of-parameters token (`--`) indicates that all arguments following it
are to be passed in their actual form as though double quotes were placed
around them. For example, using `--` you can output the string `-InputObject`
without using quotes or having it interpreted as a parameter:

```powershell
Write-Output -- -InputObject
```

```Output
-InputObject
```

This is a convention specified in the POSIX Shell and Utilities specification.

## Stop-parsing token (--%)

The stop-parsing (`--%`) token prevents PowerShell from interpreting strings as
Expand Down
Loading

0 comments on commit 296cda0

Please sign in to comment.