Join-Path

Combine a path and child-path into a single path.

Syntax
      Join-Path [-path] string[] [-childPath] string [-resolve]
          [-credential PSCredential] [-UseTransaction] [CommonParameters]

Key
   -Path string[]
       The main path (or paths) to which the child-path is appended.
       Wildcards are permitted. {may be piped}
	   
   -childPath string
       The elements to append to the value of Path.
       Wildcards are permitted. {may be piped}

   -resolve 
       Display the items that are referenced by the joined path.

   -credential PSCredential
       Use a credential to validate access to the file. Credential represents
       a user-name, such as "User01" or "Domain01\User01", or a PSCredential
       object, such as the one retrieved by using the Get-Credential cmdlet.
       If you type a user name, you will be prompted for a password.
       This parameter is not supported by any PowerShell core cmdlets or providers.

   -UseTransaction
       Include the command in the active transaction.

   CommonParameters:
       -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable,
       -OutBuffer -OutVariable.

The appropriate path delimiters will be supplied by the provider.

Examples

Join two paths:

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

The above will resolve to: C:\windows\System

Join 2 paths and display the files and folders, -resolve will display the full pathname:

PS C:\> join-path -path c:\win* system* -resolve

Display the registry keys in the HKLM\System hive that include "ControlSet":

PS C:\> set-location HKLM:
PS HKLM:\> join-path System *ControlSet* -resolve
HKLM:\System\ControlSet001
HKLM:\System\ControlSet002
HKLM:\System\CurrentControlSet

#Here come old flattop, he come grooving up slowly, He got joo-joo eyeball, he one holy roller# ~ The Beatles (Come Together)

Related:

convert-path - Convert a ps path to a provider path.
resolve-path - Resolves the wildcards in a path
split-path - Return part of a path.
test-path - Return true if the path exists, otherwise return false
get-help about_namespace


© Copyright SS64.com 1999-2014
Some rights reserved