diff --git a/reference/5.1/Microsoft.PowerShell.Management/Join-Path.md b/reference/5.1/Microsoft.PowerShell.Management/Join-Path.md index a63072f440dc..d0fda5e4467b 100644 --- a/reference/5.1/Microsoft.PowerShell.Management/Join-Path.md +++ b/reference/5.1/Microsoft.PowerShell.Management/Join-Path.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Management -ms.date: 02/26/2024 +ms.date: 03/25/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/join-path?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: Join-Path @@ -15,8 +15,8 @@ Combines a path and a child path into a single path. ## SYNTAX ``` -Join-Path [-Path] [-ChildPath] [-Resolve] [-Credential ] [-UseTransaction] - [] +Join-Path [-Path] [-ChildPath] [-Resolve] [-Credential ] + [-UseTransaction] [] ``` ## DESCRIPTION @@ -29,7 +29,7 @@ The provider supplies the path delimiters. ### Example 1: Combine a path with a child path ```powershell -PS C:\> Join-Path -Path "path" -ChildPath "childpath" +Join-Path -Path "path" -ChildPath "childpath" ``` ```output @@ -38,21 +38,21 @@ path\childpath This command uses `Join-Path` to combine a path with a childpath. -Since the command is executed from the `FileSystem` provider, it provides the `\` delimiter to join -the paths. +Since the command is executed from the **FileSystem** provider, it provides the `\` delimiter to +join the paths. ### Example 2: Combine paths that already contain directory separators ```powershell -PS C:\> Join-Path -Path "path\" -ChildPath "\childpath" +Join-Path -Path "path\" -ChildPath "\childpath" ``` ```output path\childpath ``` -Existing directory separators `\` are handled so there is only one separator between `Path` and -`ChildPath` +Existing directory separators `\` are handled so there is only one separator between **Path** and +**ChildPath**. ### Example 3: Display files and folders by joining a path with a child path @@ -62,8 +62,8 @@ Join-Path "C:\win*" "System*" -Resolve This command displays the files and folders that are referenced by joining the `C:\Win\*` path and the `System\*` child path. It displays the same files and folders as `Get-ChildItem`, but it -displays the fully qualified path to each item. In this command, the `Path` and `ChildPath` optional -parameter names are omitted. +displays the fully qualified path to each item. In this command, the **Path** and **ChildPath** +optional parameter names are omitted. ### Example 4: Use Join-Path with the PowerShell Registry provider @@ -79,7 +79,7 @@ HKLM:\System\CurrentControlSet This command displays the registry keys in the `HKLM\System` registry subkey that include `ControlSet`. -The `Resolve` parameter, attempts to resolve the joined path, including wildcards from the current +The **Resolve** parameter, attempts to resolve the joined path, including wildcards from the current provider path `HKLM:\` ### Example 5: Combine multiple path roots with a child path @@ -98,12 +98,14 @@ F:\New This command uses `Join-Path` to combine multiple path roots with a child path. > [!NOTE] -> The Drives specified by `Path` must exist or the join of that entry will fail. +> The Drives specified by **Path** must exist or the join of that entry will fail. ### Example 6: Combine the roots of a file system drive with a child path ```powershell -Get-PSDrive -PSProvider FileSystem | ForEach-Object {$_.Root} | Join-Path -ChildPath "Subdir" +Get-PSDrive -PSProvider FileSystem | + ForEach-Object {$_.Root} | + Join-Path -ChildPath "Subdir" ``` ```output @@ -111,8 +113,8 @@ C:\Subdir D:\Subdir ``` -This command combines the roots of each PowerShell file system drive in the console with the `Subdir` -child path. +This command combines the roots of each PowerShell file system drive in the console with the +`Subdir` child path. The command uses the `Get-PSDrive` cmdlet to get the PowerShell drives supported by the FileSystem provider. The `ForEach-Object` statement selects only the **Root** property of the **PSDriveInfo** @@ -143,9 +145,9 @@ Accept wildcard characters: True ### -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 @@ -161,11 +163,8 @@ Accept wildcard characters: False ### -Path -Specifies the main path (or paths) to which the child-path is appended. -Wildcards are permitted. - -The value of `Path` determines which provider joins the paths and adds the path delimiters. -The `Path` parameter is required, although the parameter name ("Path") is optional. +Specifies the main path (or paths) to which the child-path is appended. The value of **Path** +determines which provider joins the paths and adds the path delimiters. Wildcards are permitted. ```yaml Type: System.String[] @@ -183,8 +182,8 @@ Accept wildcard characters: True Indicates that this cmdlet should attempt to resolve the joined path from the current provider. -- If wildcards are used, the cmdlet returns all paths that match the joined path. -- If **no** wildcards are used, the cmdlet will error if the path does not exist. +- If you use wildcards, the cmdlet returns all paths that match the joined path. +- If you don't use wildcards, the cmdlet returns an error if the path doesn't exist. ```yaml Type: System.Management.Automation.SwitchParameter @@ -237,10 +236,10 @@ This cmdlet returns a string that contains the resulting path. ## NOTES -The cmdlets that contain the Path noun (the Path cmdlets) manipulate path names and return the names -in a concise format that all PowerShell providers can interpret. They are 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 like you would use `Dirname`, `Normpath`, `Realpath`, `Join`, or other path manipulators. +The cmdlets that contain the Path noun manipulate path names and return the names in a concise +format that all PowerShell providers can interpret. They're designed to be used where you want to +display all or part of a path in a particular format. Use them like you would use `Dirname`, +`Normpath`, `Realpath`, `Join`, or other path manipulators. You can use the path cmdlets with several providers, including the `FileSystem`, `Registry`, and `Certificate` providers. diff --git a/reference/7.4/Microsoft.PowerShell.Management/Join-Path.md b/reference/7.4/Microsoft.PowerShell.Management/Join-Path.md index 2af5ea2b7cdf..b58d3f1852f7 100644 --- a/reference/7.4/Microsoft.PowerShell.Management/Join-Path.md +++ b/reference/7.4/Microsoft.PowerShell.Management/Join-Path.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Management -ms.date: 02/26/2024 +ms.date: 03/25/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/join-path?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: Join-Path @@ -29,7 +29,7 @@ The provider supplies the path delimiters. ### Example 1: Combine a path with a child path ```powershell -PS C:\> Join-Path -Path "path" -ChildPath "childpath" +Join-Path -Path "path" -ChildPath "childpath" ``` ```output @@ -38,21 +38,21 @@ path\childpath This command uses `Join-Path` to combine a path with a childpath. -Since the command is executed from the `FileSystem` provider, it provides the `\` delimiter to join -the paths. +Since the command is executed from the **FileSystem** provider, it provides the `\` delimiter to +join the paths. ### Example 2: Combine paths that already contain directory separators ```powershell -PS C:\> Join-Path -Path "path\" -ChildPath "\childpath" +Join-Path -Path "path\" -ChildPath "\childpath" ``` ```output path\childpath ``` -Existing directory separators `\` are handled so there is only one separator between `Path` and -`ChildPath` +Existing directory separators `\` are handled so there is only one separator between **Path** and +**ChildPath**. ### Example 3: Display files and folders by joining a path with a child path @@ -62,8 +62,8 @@ Join-Path "C:\win*" "System*" -Resolve This command displays the files and folders that are referenced by joining the `C:\Win\*` path and the `System\*` child path. It displays the same files and folders as `Get-ChildItem`, but it -displays the fully qualified path to each item. In this command, the `Path` and `ChildPath` optional -parameter names are omitted. +displays the fully qualified path to each item. In this command, the **Path** and **ChildPath** +optional parameter names are omitted. ### Example 4: Use Join-Path with the PowerShell Registry provider @@ -79,7 +79,7 @@ HKLM:\System\CurrentControlSet This command displays the registry keys in the `HKLM\System` registry subkey that include `ControlSet`. -The `Resolve` parameter, attempts to resolve the joined path, including wildcards from the current +The **Resolve** parameter, attempts to resolve the joined path, including wildcards from the current provider path `HKLM:\` ### Example 5: Combine multiple path roots with a child path @@ -98,12 +98,14 @@ F:\New This command uses `Join-Path` to combine multiple path roots with a child path. > [!NOTE] -> The Drives specified by `Path` must exist or the join of that entry will fail. +> The Drives specified by **Path** must exist or the join of that entry will fail. ### Example 6: Combine the roots of a file system drive with a child path ```powershell -Get-PSDrive -PSProvider FileSystem | ForEach-Object {$_.Root} | Join-Path -ChildPath "Subdir" +Get-PSDrive -PSProvider FileSystem | + ForEach-Object {$_.Root} | + Join-Path -ChildPath "Subdir" ``` ```output @@ -111,8 +113,8 @@ C:\Subdir D:\Subdir ``` -This command combines the roots of each PowerShell file system drive in the console with the `Subdir` -child path. +This command combines the roots of each PowerShell file system drive in the console with the +`Subdir` child path. The command uses the `Get-PSDrive` cmdlet to get the PowerShell drives supported by the FileSystem provider. The `ForEach-Object` statement selects only the **Root** property of the **PSDriveInfo** @@ -131,20 +133,18 @@ Join-Path a b c d e f g a\b\c\d\e\f\g ``` -The `AdditionalChildPath` parameter allows the joining of an unlimited number of paths. +The **AdditionalChildPath** parameter allows the joining of an unlimited number of paths. -In this example, no parameter names are used, thus "a" binds to `Path`, "b" to `ChildPath` and -"c-g" to `AdditionalChildPath` +In this example, no parameter names are used, thus "a" binds to **Path**, "b" to **ChildPath** and +"c-g" to **AdditionalChildPath**. ## PARAMETERS ### -AdditionalChildPath -Specifies additional elements to append to the value of the *Path* parameter. The `ChildPath` -parameter is still mandatory and must be specified as well. - -This parameter is specified with the `ValueFromRemainingArguments` property which enables -joining an indefinite number of paths. +Specifies additional elements to append to the value of the **Path** parameter. The **ChildPath** +parameter is still mandatory and must be specified as well. This parameter is specified with the +`ValueFromRemainingArguments` property, which enables joining an indefinite number of paths. This parameter was added in PowerShell 6.0. @@ -162,8 +162,7 @@ Accept wildcard characters: False ### -ChildPath -Specifies the elements to append to the value of the `Path` parameter. Wildcards are permitted. The -`ChildPath` parameter is required, although the parameter name ("ChildPath") is optional. +Specifies the elements to append to the value of the `Path` parameter. Wildcards are permitted. ```yaml Type: System.String @@ -180,9 +179,9 @@ Accept wildcard characters: True ### -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 @@ -198,11 +197,8 @@ Accept wildcard characters: False ### -Path -Specifies the main path (or paths) to which the child-path is appended. -Wildcards are permitted. - -The value of `Path` determines which provider joins the paths and adds the path delimiters. -The `Path` parameter is required, although the parameter name ("Path") is optional. +Specifies the main path (or paths) to which the child-path is appended. The value of **Path** +determines which provider joins the paths and adds the path delimiters. Wildcards are permitted. ```yaml Type: System.String[] @@ -220,8 +216,8 @@ Accept wildcard characters: True Indicates that this cmdlet should attempt to resolve the joined path from the current provider. -- If wildcards are used, the cmdlet returns all paths that match the joined path. -- If **no** wildcards are used, the cmdlet will error if the path does not exist. +- If you use wildcards, the cmdlet returns all paths that match the joined path. +- If you don't use wildcards, the cmdlet returns an error if the path doesn't exist. ```yaml Type: System.Management.Automation.SwitchParameter @@ -256,10 +252,10 @@ This cmdlet returns a string that contains the resulting path. ## NOTES -The cmdlets that contain the Path noun (the Path cmdlets) manipulate path names and return the names -in a concise format that all PowerShell providers can interpret. They are 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 like you would use `Dirname`, `Normpath`, `Realpath`, `Join`, or other path manipulators. +The cmdlets that contain the Path noun manipulate path names and return the names in a concise +format that all PowerShell providers can interpret. They're designed to be used where you want to +display all or part of a path in a particular format. Use them like you would use `Dirname`, +`Normpath`, `Realpath`, `Join`, or other path manipulators. You can use the path cmdlets with several providers, including the `FileSystem`, `Registry`, and `Certificate` providers. diff --git a/reference/7.5/Microsoft.PowerShell.Management/Join-Path.md b/reference/7.5/Microsoft.PowerShell.Management/Join-Path.md index 4b9a116f2e13..c4792d4f4dd4 100644 --- a/reference/7.5/Microsoft.PowerShell.Management/Join-Path.md +++ b/reference/7.5/Microsoft.PowerShell.Management/Join-Path.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Management -ms.date: 02/26/2024 +ms.date: 03/25/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/join-path?view=powershell-7.5&WT.mc_id=ps-gethelp schema: 2.0.0 title: Join-Path @@ -38,8 +38,8 @@ path\childpath This command uses `Join-Path` to combine a path with a childpath. -Since the command is executed from the `FileSystem` provider, it provides the `\` delimiter to join -the paths. +Since the command is executed from the **FileSystem** provider, it provides the `\` delimiter to +join the paths. ### Example 2: Combine paths that already contain directory separators @@ -51,8 +51,8 @@ Join-Path -Path "path\" -ChildPath "\childpath" path\childpath ``` -Existing directory separators `\` are handled so there is only one separator between `Path` and -`ChildPath` +Existing directory separators `\` are handled so there is only one separator between **Path** and +**ChildPath**. ### Example 3: Display files and folders by joining a path with a child path @@ -62,8 +62,8 @@ Join-Path "C:\win*" "System*" -Resolve This command displays the files and folders that are referenced by joining the `C:\Win\*` path and the `System\*` child path. It displays the same files and folders as `Get-ChildItem`, but it -displays the fully qualified path to each item. In this command, the `Path` and `ChildPath` optional -parameter names are omitted. +displays the fully qualified path to each item. In this command, the **Path** and **ChildPath** +optional parameter names are omitted. ### Example 4: Use Join-Path with the PowerShell Registry provider @@ -79,7 +79,7 @@ HKLM:\System\CurrentControlSet This command displays the registry keys in the `HKLM\System` registry subkey that include `ControlSet`. -The `Resolve` parameter, attempts to resolve the joined path, including wildcards from the current +The **Resolve** parameter, attempts to resolve the joined path, including wildcards from the current provider path `HKLM:\` ### Example 5: Combine multiple path roots with a child path @@ -98,12 +98,14 @@ F:\New This command uses `Join-Path` to combine multiple path roots with a child path. > [!NOTE] -> The Drives specified by `Path` must exist or the join of that entry will fail. +> The Drives specified by **Path** must exist or the join of that entry will fail. ### Example 6: Combine the roots of a file system drive with a child path ```powershell -Get-PSDrive -PSProvider FileSystem | ForEach-Object {$_.Root} | Join-Path -ChildPath "Subdir" +Get-PSDrive -PSProvider FileSystem | + ForEach-Object {$_.Root} | + Join-Path -ChildPath "Subdir" ``` ```output @@ -131,20 +133,18 @@ Join-Path a b c d e f g a\b\c\d\e\f\g ``` -The `AdditionalChildPath` parameter allows the joining of an unlimited number of paths. +The **AdditionalChildPath** parameter allows the joining of an unlimited number of paths. -In this example, no parameter names are used, thus "a" binds to `Path`, "b" to `ChildPath` and -"c-g" to `AdditionalChildPath` +In this example, no parameter names are used, thus "a" binds to **Path**, "b" to **ChildPath** and +"c-g" to **AdditionalChildPath**. ## PARAMETERS ### -AdditionalChildPath -Specifies additional elements to append to the value of the *Path* parameter. The `ChildPath` -parameter is still mandatory and must be specified as well. - -This parameter is specified with the `ValueFromRemainingArguments` property which enables -joining an indefinite number of paths. +Specifies additional elements to append to the value of the **Path** parameter. The **ChildPath** +parameter is still mandatory and must be specified as well. This parameter is specified with the +`ValueFromRemainingArguments` property, which enables joining an indefinite number of paths. This parameter was added in PowerShell 6.0. @@ -162,9 +162,7 @@ Accept wildcard characters: False ### -ChildPath -Specifies the elements to append to the value of the `Path` parameter. Wildcards are permitted. The -`ChildPath` parameter is required, although the parameter name ("ChildPath") is optional. - +Specifies the elements to append to the value of the `Path` parameter. Wildcards are permitted. ```yaml Type: System.String Parameter Sets: (All) @@ -180,9 +178,9 @@ Accept wildcard characters: True ### -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 @@ -198,11 +196,8 @@ Accept wildcard characters: False ### -Path -Specifies the main path (or paths) to which the child-path is appended. -Wildcards are permitted. - -The value of `Path` determines which provider joins the paths and adds the path delimiters. -The `Path` parameter is required, although the parameter name ("Path") is optional. +Specifies the main path (or paths) to which the child-path is appended. The value of **Path** +determines which provider joins the paths and adds the path delimiters. Wildcards are permitted. ```yaml Type: System.String[] @@ -220,8 +215,8 @@ Accept wildcard characters: True Indicates that this cmdlet should attempt to resolve the joined path from the current provider. -- If wildcards are used, the cmdlet returns all paths that match the joined path. -- If **no** wildcards are used, the cmdlet will error if the path does not exist. +- If you use wildcards, the cmdlet returns all paths that match the joined path. +- If you don't use wildcards, the cmdlet returns an error if the path doesn't exist. ```yaml Type: System.Management.Automation.SwitchParameter @@ -256,10 +251,10 @@ This cmdlet returns a string that contains the resulting path. ## NOTES -The cmdlets that contain the Path noun (the Path cmdlets) manipulate path names and return the names -in a concise format that all PowerShell providers can interpret. They are 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 like you would use `Dirname`, `Normpath`, `Realpath`, `Join`, or other path manipulators. +The cmdlets that contain the Path noun manipulate path names and return the names in a concise +format that all PowerShell providers can interpret. They're designed to be used where you want to +display all or part of a path in a particular format. Use them like you would use `Dirname`, +`Normpath`, `Realpath`, `Join`, or other path manipulators. You can use the path cmdlets with several providers, including the `FileSystem`, `Registry`, and `Certificate` providers. diff --git a/reference/7.6/Microsoft.PowerShell.Management/Join-Path.md b/reference/7.6/Microsoft.PowerShell.Management/Join-Path.md index a218230e4ec0..581d48c8ce09 100644 --- a/reference/7.6/Microsoft.PowerShell.Management/Join-Path.md +++ b/reference/7.6/Microsoft.PowerShell.Management/Join-Path.md @@ -2,7 +2,7 @@ external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Management -ms.date: 02/26/2024 +ms.date: 03/25/2025 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/join-path?view=powershell-7.6&WT.mc_id=ps-gethelp schema: 2.0.0 title: Join-Path @@ -29,7 +29,7 @@ The provider supplies the path delimiters. ### Example 1: Combine a path with a child path ```powershell -PS C:\> Join-Path -Path "path" -ChildPath "childpath" +Join-Path -Path "path" -ChildPath "childpath" ``` ```output @@ -38,21 +38,21 @@ path\childpath This command uses `Join-Path` to combine a path with a childpath. -Since the command is executed from the `FileSystem` provider, it provides the `\` delimiter to join -the paths. +Since the command is executed from the **FileSystem** provider, it provides the `\` delimiter to +join the paths. ### Example 2: Combine paths that already contain directory separators ```powershell -PS C:\> Join-Path -Path "path\" -ChildPath "\childpath" +Join-Path -Path "path\" -ChildPath "\childpath" ``` ```output path\childpath ``` -Existing directory separators `\` are handled so there is only one separator between `Path` and -`ChildPath` +Existing directory separators `\` are handled so there is only one separator between **Path** and +**ChildPath**. ### Example 3: Display files and folders by joining a path with a child path @@ -62,8 +62,8 @@ Join-Path "C:\win*" "System*" -Resolve This command displays the files and folders that are referenced by joining the `C:\Win\*` path and the `System\*` child path. It displays the same files and folders as `Get-ChildItem`, but it -displays the fully qualified path to each item. In this command, the `Path` and `ChildPath` optional -parameter names are omitted. +displays the fully qualified path to each item. In this command, the **Path** and **ChildPath** +optional parameter names are omitted. ### Example 4: Use Join-Path with the PowerShell Registry provider @@ -79,7 +79,7 @@ HKLM:\System\CurrentControlSet This command displays the registry keys in the `HKLM\System` registry subkey that include `ControlSet`. -The `Resolve` parameter, attempts to resolve the joined path, including wildcards from the current +The **Resolve** parameter, attempts to resolve the joined path, including wildcards from the current provider path `HKLM:\` ### Example 5: Combine multiple path roots with a child path @@ -98,12 +98,14 @@ F:\New This command uses `Join-Path` to combine multiple path roots with a child path. > [!NOTE] -> The Drives specified by `Path` must exist or the join of that entry will fail. +> The Drives specified by **Path** must exist or the join of that entry will fail. ### Example 6: Combine the roots of a file system drive with a child path ```powershell -Get-PSDrive -PSProvider FileSystem | ForEach-Object {$_.Root} | Join-Path -ChildPath "Subdir" +Get-PSDrive -PSProvider FileSystem | + ForEach-Object {$_.Root} | + Join-Path -ChildPath "Subdir" ``` ```output @@ -111,8 +113,8 @@ C:\Subdir D:\Subdir ``` -This command combines the roots of each PowerShell file system drive in the console with the `Subdir` -child path. +This command combines the roots of each PowerShell file system drive in the console with the +`Subdir` child path. The command uses the `Get-PSDrive` cmdlet to get the PowerShell drives supported by the FileSystem provider. The `ForEach-Object` statement selects only the **Root** property of the **PSDriveInfo** @@ -131,20 +133,30 @@ Join-Path a b c d e f g a\b\c\d\e\f\g ``` -The `AdditionalChildPath` parameter allows the joining of an unlimited number of paths. +The **AdditionalChildPath** parameter allows the joining of an unlimited number of paths. -In this example, no parameter names are used, thus "a" binds to `Path`, "b" to `ChildPath` and -"c-g" to `AdditionalChildPath` +In this example, no parameter names are used, thus "a" binds to **Path**, "b" to **ChildPath** and +"c-g" to **AdditionalChildPath**. + +### Example 8: Combine an indefinite number of paths + +The **ChildPath** parameter allows the joining of an array of paths. + +```powershell +Join-Path -Path a -ChildPath b, c, d, e, f, g +``` + +```Output +a\b\c\d\e\f\g +``` ## PARAMETERS ### -AdditionalChildPath -Specifies additional elements to append to the value of the *Path* parameter. The `ChildPath` -parameter is still mandatory and must be specified as well. - -This parameter is specified with the `ValueFromRemainingArguments` property which enables -joining an indefinite number of paths. +Specifies additional elements to append to the value of the **Path** parameter. The **ChildPath** +parameter is still mandatory and must be specified as well. This parameter is specified with the +`ValueFromRemainingArguments` property, which enables joining an indefinite number of paths. This parameter was added in PowerShell 6.0. @@ -162,11 +174,14 @@ Accept wildcard characters: False ### -ChildPath -Specifies the elements to append to the value of the `Path` parameter. Wildcards are permitted. The -`ChildPath` parameter is required, although the parameter name ("ChildPath") is optional. +Specifies the elements to append to the value of the `Path` parameter. Wildcards are permitted. + +Beginning in PowerShell 7.6-preview.4, this parameter accepts an array of strings. This allows you +to specify multiple child paths to join with the main path. You can use this parameter instead of +the **AdditionalChildPath** parameter. ```yaml -Type: System.String +Type: System.String[] Parameter Sets: (All) Aliases: @@ -180,9 +195,9 @@ Accept wildcard characters: True ### -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 @@ -198,11 +213,8 @@ Accept wildcard characters: False ### -Path -Specifies the main path (or paths) to which the child-path is appended. -Wildcards are permitted. - -The value of `Path` determines which provider joins the paths and adds the path delimiters. -The `Path` parameter is required, although the parameter name ("Path") is optional. +Specifies the main path (or paths) to which the child-path is appended. The value of **Path** +determines which provider joins the paths and adds the path delimiters. Wildcards are permitted. ```yaml Type: System.String[] @@ -220,8 +232,8 @@ Accept wildcard characters: True Indicates that this cmdlet should attempt to resolve the joined path from the current provider. -- If wildcards are used, the cmdlet returns all paths that match the joined path. -- If **no** wildcards are used, the cmdlet will error if the path does not exist. +- If you use wildcards, the cmdlet returns all paths that match the joined path. +- If you don't use wildcards, the cmdlet returns an error if the path doesn't exist. ```yaml Type: System.Management.Automation.SwitchParameter @@ -256,10 +268,10 @@ This cmdlet returns a string that contains the resulting path. ## NOTES -The cmdlets that contain the Path noun (the Path cmdlets) manipulate path names and return the names -in a concise format that all PowerShell providers can interpret. They are 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 like you would use `Dirname`, `Normpath`, `Realpath`, `Join`, or other path manipulators. +The cmdlets that contain the Path noun manipulate path names and return the names in a concise +format that all PowerShell providers can interpret. They're designed to be used where you want to +display all or part of a path in a particular format. Use them like you would use `Dirname`, +`Normpath`, `Realpath`, `Join`, or other path manipulators. You can use the path cmdlets with several providers, including the `FileSystem`, `Registry`, and `Certificate` providers.