Skip to content

Commit

Permalink
Fix example 3
Browse files Browse the repository at this point in the history
  • Loading branch information
sdwheeler committed Sep 20, 2023
1 parent e08d651 commit 6567e56
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 76 deletions.
57 changes: 29 additions & 28 deletions reference/5.1/Microsoft.PowerShell.Management/Split-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: 07/31/2023
ms.date: 09/20/2023
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/split-path?view=powershell-5.1&WT.mc_id=ps-gethelp
schema: 2.0.0
title: Split-Path
Expand Down Expand Up @@ -60,7 +60,7 @@ Split-Path -LiteralPath <String[]> [-Resolve] [-Credential <PSCredential>] [-Use
## DESCRIPTION

The `Split-Path` cmdlet returns only the specified part of a path, such as the parent folder, a
subfolder, or a file name. It can also get items that are referenced by the split path and tell
subfolder, or a filename. It can also get items that are referenced by the split path and tell
whether the path is relative or absolute.

You can use this cmdlet to get or submit only a selected part of a path.
Expand All @@ -79,7 +79,7 @@ HKCU:

This command returns only the qualifier of the path. The qualifier is the drive.

### Example 2: Display file names
### Example 2: Display filenames

```powershell
Split-Path -Path "C:\Test\Logs\*.log" -Leaf -Resolve
Expand All @@ -92,25 +92,25 @@ Pass2.log
```

This command displays the files that are referenced by the split path. Because this path is split to
the last item, also known as the leaf, the command displays only the file names.
the last item, also known as the leaf, the command displays only the filenames.

The **Resolve** parameter tells `Split-Path` to display the items that the split path references,
instead of displaying the split path.

Like all `Split-Path` commands, this command returns strings.
It does not return **FileInfo** objects that represent the files.
Like all `Split-Path` commands, this command returns strings. It doesn't return **FileInfo** objects
that represent the files.

### Example 3: Get the parent container

```powershell
Split-Path -Path "C:\WINDOWS\system32\WindowsPowerShell\V1.0\about_*.txt"
Split-Path -Parent "C:\WINDOWS\system32\WindowsPowerShell\V1.0\about_*.txt"
```

```Output
C:\WINDOWS\system32\WindowsPowerShell\V1.0
```

This command returns only the parent containers of the path. Because it does not include any
This command returns only the parent containers of the path. Because it doesn't include any
parameters to specify the split, `Split-Path` uses the split location default, which is **Parent**.

### Example 4: Determines whether a path is absolute
Expand All @@ -124,12 +124,12 @@ False
```

This command determines whether the path is relative or absolute. In this case, because the path is
relative to the current folder, which is represented by a dot (`.`), it returns $False.
relative to the current folder, which is represented by a dot (`.`), it returns `$False`.

### Example 5: Change location to a specified path

```powershell
PS C:> Set-Location (Split-Path -Path $profile)
PS C:\> Set-Location (Split-Path -Path $profile)
PS C:\Documents and Settings\User01\My Documents\WindowsPowerShell>
```

Expand All @@ -140,7 +140,7 @@ built-in `$Profile` variable. The **Parent** parameter is the default split loca
Therefore, you can omit it from the command. The parentheses direct PowerShell to run the command
first. This is a useful way to move to a folder that has a long path name.

### Example 6: Split a path by using the pipeline
### Example 6: Split a path using the pipeline

```powershell
'C:\Documents and Settings\User01\My Documents\My Pictures' | Split-Path
Expand All @@ -150,17 +150,17 @@ first. This is a useful way to move to a folder that has a long path name.
C:\Documents and Settings\User01\My Documents
```

This command uses a pipeline operator (`|`) to send a path to `Split-Path`.
The path is enclosed in quotation marks to indicate that it is a single token.
This command uses a pipeline operator (`|`) to send a path to `Split-Path`. The path is enclosed in
quotation marks to indicate that it's a single token.

## PARAMETERS

### -Credential

> [!NOTE]
> This parameter is not supported by any providers installed with PowerShell.
> To impersonate another user, or elevate your credentials when running this cmdlet,
> use [Invoke-Command](../Microsoft.PowerShell.Core/Invoke-Command.md).
> This parameter isn't supported by any providers installed with PowerShell. To impersonate another
> user, or elevate your credentials when running this cmdlet, use
> [Invoke-Command](../Microsoft.PowerShell.Core/Invoke-Command.md).
```yaml
Type: System.Management.Automation.PSCredential
Expand All @@ -176,8 +176,8 @@ Accept wildcard characters: False
### -IsAbsolute
Indicates that this cmdlet returns `$True` if the path is absolute and $False if it is relative. An
absolute path has a length greater than zero and does not use a dot (`.`) to indicate the current
Indicates that this cmdlet returns `$True` if the path is absolute and `$False` if it's relative. An
absolute path has a length greater than zero and doesn't use a dot (`.`) to indicate the current
path.

```yaml
Expand Down Expand Up @@ -231,8 +231,8 @@ Accept wildcard characters: False
### -NoQualifier

Indicates that this cmdlet returns the path without the qualifier. For the FileSystem or registry
providers, the qualifier is the drive of the provider path, such as C: or HKCU:. For example, in the
path `C:\Test\Logs\Pass1.log`, it returns only \Test\Logs\Pass1.log.
providers, the qualifier is the drive of the provider path, such as `C:` or `HKCU:`. For example, in the
path `C:\Test\Logs\Pass1.log`, it returns only `\Test\Logs\Pass1.log`.

```yaml
Type: System.Management.Automation.SwitchParameter
Expand All @@ -249,7 +249,7 @@ Accept wildcard characters: False
### -Parent

Indicates that this cmdlet returns only the parent containers of the item or of the container
specified by the path. For example, in the path `C:\Test\Logs\Pass1.log`, it returns C:\Test\Logs.
specified by the path. For example, in the path `C:\Test\Logs\Pass1.log`, it returns `C:\Test\Logs`.
The **Parent** parameter is the default split location parameter.

```yaml
Expand Down Expand Up @@ -284,7 +284,7 @@ Accept wildcard characters: True
### -Qualifier

Indicates that this cmdlet returns only the qualifier of the specified path. For the FileSystem or
registry providers, the qualifier is the drive of the provider path, such as C: or HKCU:.
registry providers, the qualifier is the drive of the provider path, such as `C:` or `HKCU:`.

```yaml
Type: System.Management.Automation.SwitchParameter
Expand Down Expand Up @@ -336,7 +336,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](https://go.microsoft.com/fwlink/?LinkID=113216).
-WarningAction, and -WarningVariable. For more information, see
[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

Expand All @@ -349,7 +350,7 @@ You can pipe a string that contains a path to this cmdlet.
### System.String

This cmdlet returns text strings. When you specify the **Resolve** parameter, it returns a
string that describes the location of the items. It does not return objects that represent the
string that describes the location of the items. It doesn't return objects that represent the
items, such as a **FileInfo** or **RegistryKey** object.

### System.Boolean
Expand All @@ -361,16 +362,16 @@ When you specify the **IsAbsolute** parameter, this cmdlet returns a **Boolean**
- The split location parameters (**Qualifier**, **Parent**, **Leaf**, and **NoQualifier**) are
exclusive. You can use only one in each command.

The cmdlets that contain the **Path** noun (the **Path** cmdlets) work with path names and return
the names in a concise format that all PowerShell providers can interpret. They are designed for
- The cmdlets that contain the **Path** noun (the **Path** cmdlets) work with path names and return
the names in a concise format that all PowerShell providers can interpret. They're designed for
use in programs and scripts where you want to display all or part of a path name in a particular
format. Use them in the way that you would use **Dirname**, **Normpath**, **Realpath**, **Join**,
or other path manipulators.

You can use the **Path** cmdlets together with several providers. These include the FileSystem,
- You can use the **Path** cmdlets together with several providers. These include the FileSystem,
Registry, and Certificate providers.

`Split-Path` is designed to work with the data exposed by any provider. To list the providers
- `Split-Path` is designed to work with the data exposed by any provider. To list the providers
available in your session, type `Get-PSProvider`. For more information, see [about_Providers](../Microsoft.PowerShell.Core/About/about_Providers.md).

## RELATED LINKS
Expand Down
33 changes: 17 additions & 16 deletions reference/7.2/Microsoft.PowerShell.Management/Split-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: 07/31/2023
ms.date: 09/20/2023
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/split-path?view=powershell-7.2&WT.mc_id=ps-gethelp
schema: 2.0.0
title: Split-Path
Expand Down Expand Up @@ -72,7 +72,7 @@ Split-Path -LiteralPath <String[]> [-Resolve] [-Credential <PSCredential>] [<Com
## DESCRIPTION

The `Split-Path` cmdlet returns only the specified part of a path, such as the parent folder, a
subfolder, or a file name. It can also get items that are referenced by the split path and tell
subfolder, or a filename. It can also get items that are referenced by the split path and tell
whether the path is relative or absolute.

You can use this cmdlet to get or submit only a selected part of a path.
Expand All @@ -91,7 +91,7 @@ HKCU:

This command returns only the qualifier of the path. The qualifier is the drive.

### Example 2: Display file names
### Example 2: Display filenames

```powershell
Split-Path -Path "C:\Test\Logs\*.log" -Leaf -Resolve
Expand All @@ -104,25 +104,25 @@ Pass2.log
```

This command displays the files that are referenced by the split path. Because this path is split to
the last item, also known as the leaf, the command displays only the file names.
the last item, also known as the leaf, the command displays only the filenames.

The **Resolve** parameter tells `Split-Path` to display the items that the split path references,
instead of displaying the split path.

Like all `Split-Path` commands, this command returns strings. It does not return **FileInfo**
objects that represent the files.
Like all `Split-Path` commands, this command returns strings. It doesn't return **FileInfo** objects
that represent the files.

### Example 3: Get the parent container

```powershell
Split-Path -Path "C:\WINDOWS\system32\WindowsPowerShell\V1.0\about_*.txt"
Split-Path -Parent "C:\WINDOWS\system32\WindowsPowerShell\V1.0\about_*.txt"
```

```Output
C:\WINDOWS\system32\WindowsPowerShell\V1.0
```

This command returns only the parent containers of the path. Because it does not include any
This command returns only the parent containers of the path. Because it doesn't include any
parameters to specify the split, `Split-Path` uses the split location default, which is **Parent**.

### Example 4: Determines whether a path is absolute
Expand Down Expand Up @@ -152,7 +152,7 @@ built-in `$Profile` variable. The **Parent** parameter is the default split loca
Therefore, you can omit it from the command. The parentheses direct PowerShell to run the command
first. This is a useful way to move to a folder that has a long path name.

### Example 6: Split a path by using the pipeline
### Example 6: Split a path using the pipeline

```powershell
'C:\Documents and Settings\User01\My Documents\My Pictures' | Split-Path
Expand All @@ -163,15 +163,16 @@ C:\Documents and Settings\User01\My Documents
```

This command uses a pipeline operator (`|`) to send a path to `Split-Path`. The path is enclosed in
quotation marks to indicate that it is a single token.
quotation marks to indicate that it's a single token.

## PARAMETERS

### -Credential

> [!NOTE]
> This parameter is not supported by any providers installed with PowerShell. To impersonate another
> user, or elevate your credentials when running this cmdlet, use [Invoke-Command](../Microsoft.PowerShell.Core/Invoke-Command.md).
> This parameter isn't supported by any providers installed with PowerShell. To impersonate another
> user, or elevate your credentials when running this cmdlet, use
> [Invoke-Command](../Microsoft.PowerShell.Core/Invoke-Command.md).
```yaml
Type: System.Management.Automation.PSCredential
Expand Down Expand Up @@ -206,8 +207,8 @@ Accept wildcard characters: False

### -IsAbsolute

Indicates that this cmdlet returns `$True` if the path is absolute and `$False` if it is relative. An
absolute path has a length greater than zero and does not use a dot (`.`) to indicate the current
Indicates that this cmdlet returns `$True` if the path is absolute and `$False` if it's relative. An
absolute path has a length greater than zero and doesn't use a dot (`.`) to indicate the current
path.

```yaml
Expand Down Expand Up @@ -382,7 +383,7 @@ You can pipe a string that contains a path to this cmdlet.
### System.String

This cmdlet returns text strings. When you specify the **Resolve** parameter, it returns a
string that describes the location of the items. It does not return objects that represent the
string that describes the location of the items. It doesn't return objects that represent the
items, such as a **FileInfo** or **RegistryKey** object.

### System.Boolean
Expand All @@ -395,7 +396,7 @@ When you specify the **IsAbsolute** parameter, this cmdlet returns a **Boolean**
and **NoQualifier**) are exclusive. You can use only one in each command.

- The cmdlets that contain the **Path** noun (the **Path** cmdlets) work with path names and return
the names in a concise format that all PowerShell providers can interpret. They are designed for
the names in a concise format that all PowerShell providers can interpret. They're designed for
use in programs and scripts where you want to display all or part of a path name in a particular
format. Use them in the way that you would use **Dirname**, **Normpath**, **Realpath**, **Join**,
or other path manipulators.
Expand Down
Loading

0 comments on commit 6567e56

Please sign in to comment.