CmdID / PowerShell / Cmdlets / Join
Join-Path
Combines a path and a child path into a single path. PowerShell reference
From the PowerShell reference 5 parameters
What it does
Combines a path and a child path into a single path. The Join-Path cmdlet combines a path and child-path into a single path. The provider supplies the path delimiters.
Join-Path [-Path] <String[]> [-ChildPath] <String> [-Resolve] [-Credential <PSCredential>] [-UseTransaction] [<CommonParameters>]
Combine a path with a child path
Join-Path -Path "path" -ChildPath "childpath"IdentifyCombine paths that already contain directory separators
Join-Path -Path "path\" -ChildPath "\childpath"IdentifyDisplay files and folders by joining a path with a child path
Join-Path "C:\win*" "System*" -ResolveIdentifyUse Join-Path with the PowerShell Registry provider
PS HKLM:> Join-Path -Path System -ChildPath ControlSet -ResolveIdentifyCombine multiple path roots with a child path
Join-Path -Path C:, D:, E:, F: -ChildPath NewIdentifyCombine the roots of a file system drive with a child path
Get-PSDrive -PSProvider FileSystem |
ForEach-Object {$_.Root} |
Join-Path -ChildPath "Subdir"IdentifyIts page in the reference: Join-Path.
Parameters
-ChildPathSpecifies 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.-CredentialNOTE: 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.-PathSpecifies 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.-ResolveIndicates that this cmdlet should attempt to resolve the joined path from the current provider.
- 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.-UseTransactionIncludes the command in the active transaction. This parameter is valid only when a transaction is in progress. For more information, see about_Transactions.