PowerShell Logo Small

Join-Path



This is the built-in help made by Microsoft for the command 'Join-Path', in PowerShell version 3 - as retrieved from Windows version 'Microsoft Windows Server 2012 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Combines a path and a child path into a single path. The provider supplies the path delimiters.

SYNTAX


Join-Path [-Path] <String[]> [-ChildPath] <String> [-Credential <PSCredential>] [-Resolve] [-UseTransaction] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Join-Path cmdlet combines a path and child-path into a single path. The provider supplies the path delimiters.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/?LinkID=113347
Convert-Path
Resolve-Path
Split-Path
Test-Path
about_Providers

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

PS C:\>join-path -path c:\win* -childpath System*



This command uses Join-Path to combine the "c:\Win*" path with the "System*" child path. The Windows PowerShell file system provider,
FileSystem joins the path and adds the "\" delimiter.








-------------------------- EXAMPLE 2 --------------------------

PS C:\>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.








-------------------------- EXAMPLE 3 --------------------------

PS C:\>PS HKLM:\> join-path System *ControlSet* -resolve



This command displays the registry keys in the HKLM\System registry subkey that include "ControlSet". This example shows how to use Join-Path
with the Windows PowerShell registry provider.








-------------------------- EXAMPLE 4 --------------------------

PS C:\>join-path -path C:, D:, E:, F: -childpath New



This command uses Join-Path to combine multiple path roots with a child path.








-------------------------- EXAMPLE 5 --------------------------

PS C:\>get-psdrive -psprovider filesystem | foreach {$_.root} | join-path -childpath Subdir



This command combines the roots of each Windows PowerShell file system drive in the console with the Subdir child path.

The command uses the Get-PSDrive cmdlet to get the Windows PowerShell drives supported by the FileSystem provider. The ForEach statement
selects only the Root property of the PSDriveInfo objects and combines it with the specified child path.

The output shows that the Windows PowerShell drives on the computer included a drive mapped to the C:\Program Files directory.