Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -627,8 +627,8 @@ The acceptable values for `mode` are:
- Default (0) - Return all items
- First (1) - Return the first item
- Last (2) - Return the last item
- SkipUntil (3) - Skip items until condition is true, the return the remaining
items
- SkipUntil (3) - Skip items until condition is true, return all the remaining
items (including the first item for which the condition is true)
- Until (4) - Return all items until condition is true
- Split (5) - Return an array of two elements
- The first element contains matching items
Expand Down
28 changes: 23 additions & 5 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,14 +200,15 @@ prevent PowerShell from misinterpreting the parentheses.
icacls X:\VMS /grant Dom\HVAdmin:`(CI`)`(OI`)F
```

### The stop-parsing token

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.

### The stop-parsing token

When calling a native command, place the stop-parsing token before the program
arguments. This technique is much easier than using escape characters to
prevent misinterpretation.
Expand Down Expand Up @@ -238,6 +239,23 @@ 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

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
20 changes: 10 additions & 10 deletions reference/5.1/Microsoft.PowerShell.Management/Resolve-Path.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml
Locale: en-US
Module Name: Microsoft.PowerShell.Management
ms.date: 03/12/2020
ms.date: 05/16/2022
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.management/resolve-path?view=powershell-5.1&WT.mc_id=ps-gethelp
schema: 2.0.0
title: Resolve-Path
Expand Down Expand Up @@ -31,13 +31,13 @@ Resolve-Path -LiteralPath <String[]> [-Relative] [-Credential <PSCredential>] [-

The `Resolve-Path` cmdlet displays the items and containers that match the wildcard pattern at the
location specified. The match can include files, folders, registry keys, or any other object
accessible from a PSDrive provider.
accessible from a **PSDrive** provider.

## EXAMPLES

### Example 1: Resolve the home folder path

The tilde character (~) is shorthand notation for the current user's home folder. This example
The tilde character (`~`) is shorthand notation for the current user's home folder. This example
shows `Resolve-Path` returning the fully qualified path value.

```powershell
Expand All @@ -62,17 +62,17 @@ Path
C:\Windows
```

When run from the root of the C: drive, this command returns the path of the Windows folder in the
C: drive.
When run from the root of the `C:` drive, this command returns the path of the `Windows` folder in
the `C:` drive.

### Example 3: Get all paths in the Windows folder

```powershell
PS C:\> "C:\windows\*" | Resolve-Path
```

This command returns all of the folders in the C:\Windows folder. The command uses a pipeline
operator (|) to send a path string to `Resolve-Path`.
This command returns all the files and folders in the `C:\Windows` folder. The command uses a
pipeline operator (`|`) to send a path string to `Resolve-Path`.

### Example 4: Resolve a UNC path

Expand All @@ -94,11 +94,11 @@ PS C:\> Resolve-Path -Path "c:\prog*" -Relative
.\programs.txt
```

This command returns relative paths for the directories at the root of the C: drive.
This command returns relative paths for the directories at the root of the `C:` drive.

### Example 6: Resolve a path containing brackets

This example uses the **LiteralPath** parameter to resolve the path of the Test\[xml\] subfolder.
This example uses the **LiteralPath** parameter to resolve the path of the `Test[xml]` subfolder.
Using **LiteralPath** causes the brackets to be treated as normal characters rather than a regular
expression.

Expand Down Expand Up @@ -222,7 +222,7 @@ Returns a **PathInfo** object. Returns a string value for the resolved path if y

## NOTES

The `*-Path` cmdlets work with the FileSystem, Registry, and Certificate providers.
The `*-Path` cmdlets work with the **FileSystem**, **Registry**, and **Certificate** providers.

`Resolve-Path` is designed to work with any provider. To list the providers available in your
session, type `Get-PSProvider`. For more information, see
Expand Down
37 changes: 20 additions & 17 deletions reference/5.1/Microsoft.PowerShell.Utility/Start-Sleep.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
Locale: en-US
Module Name: Microsoft.PowerShell.Utility
ms.date: 03/13/2019
ms.date: 05/16/2022
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/start-sleep?view=powershell-5.1&WT.mc_id=ps-gethelp
schema: 2.0.0
title: Start-Sleep
Expand All @@ -29,35 +29,37 @@ Start-Sleep -Milliseconds <Int32> [<CommonParameters>]
## DESCRIPTION

The `Start-Sleep` cmdlet suspends the activity in a script or session for the specified period of
time.
You can use it for many tasks, such as waiting for an operation to complete or pausing before
time. You can use it for many tasks, such as waiting for an operation to complete or pausing before
repeating an operation.

## EXAMPLES

### Example 1: Sleep all commands for 15 seconds
### Example 1: Pause execution for 1.5 seconds

This example execution of commands for one and one-half of a seconds.

```powershell
Start-Sleep -s 15
Start-Sleep -Seconds 1.5
```

This command makes all commands in the session sleep for 15 seconds.
### Example 2: Pause execution at the command line

### Example 2: Sleep all commands
This example shows that execution is paused for 5 seconds when run from the command line.

```powershell
Start-Sleep -m 500
PS> Get-Date; Start-Sleep -Seconds 5; Get-Date

Friday, May 13, 2022 9:38:15 AM
Friday, May 13, 2022 9:38:20 AM
```

This command makes all the commands in the session sleep for one-half of a second (500
milliseconds).
PowerShell cannot execute the second `Get-Date` command until the sleep timer expires.

## PARAMETERS

### -Milliseconds

Specifies how long the resource sleeps in milliseconds.
The parameter can be abbreviated as **m**.
Specifies how long the resource sleeps in milliseconds. The parameter can be abbreviated as **m**.

```yaml
Type: System.Int32
Expand All @@ -73,8 +75,8 @@ Accept wildcard characters: False

### -Seconds

Specifies how long the resource sleeps in seconds.
You can omit the parameter name (**Seconds**), or you can abbreviate it as **s**.
Specifies how long the resource sleeps in seconds. You can omit the parameter name or you can
abbreviate it as **s**.

```yaml
Type: System.Int32
Expand All @@ -92,7 +94,8 @@ Accept wildcard characters: False

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](../Microsoft.PowerShell.Core/About/about_CommonParameters.md).
-WarningAction, and -WarningVariable. For more information, see
[about_CommonParameters](../Microsoft.PowerShell.Core/About/about_CommonParameters.md).

## INPUTS

Expand All @@ -111,7 +114,7 @@ This cmdlet does not return any output.
- You can also refer to `Start-Sleep` by its built-in alias, `sleep`. For more information, see
[about_Aliases](../Microsoft.PowerShell.Core/About/about_Aliases.md).
- `Ctrl+C` breaks out of `Start-Sleep`.
- `Ctrl+C` does not break out of `[Threading.Thread]::Sleep`. For more information, see
[Thread.Sleep Method](/dotnet/api/system.threading.thread.sleep).
- `Ctrl+C` does not break out of `[Threading.Thread]::Sleep`. For more information, see
[Thread.Sleep Method](/dotnet/api/system.threading.thread.sleep).

## RELATED LINKS
Original file line number Diff line number Diff line change
Expand Up @@ -627,8 +627,8 @@ The acceptable values for `mode` are:
- Default (0) - Return all items
- First (1) - Return the first item
- Last (2) - Return the last item
- SkipUntil (3) - Skip items until condition is true, the return the remaining
items
- SkipUntil (3) - Skip items until condition is true, return all the remaining
items (including the first item for which the condition is true)
- Until (4) - Return all items until condition is true
- Split (5) - Return an array of two elements
- The first element contains matching items
Expand Down
28 changes: 23 additions & 5 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,14 +200,15 @@ prevent PowerShell from misinterpreting the parentheses.
icacls X:\VMS /grant Dom\HVAdmin:`(CI`)`(OI`)F
```

### The stop-parsing token

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.

### The stop-parsing token

When calling a native command, place the stop-parsing token before the program
arguments. This technique is much easier than using escape characters to
prevent misinterpretation.
Expand Down Expand Up @@ -238,6 +239,23 @@ 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

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
Loading