Join-Path
SYNOPSIS
Combines a path and child-path into a single path. The provider supplies the path delimiters.
SYNTAX
Join-Path [-path] <string[]> [-childPath] <string> [-resolve] [-credential <PSCredential>] [<CommonParameters>]
DETAILED DESCRIPTION
The Join-Path cmdlet combines a path and child-path into a single path. The provider supplies the path delimiters.
PARAMETERS
-path <string[]>
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.
Required?true
Position? |
1 |
Default value |
N/A - The path must be specified |
Accept pipeline input? |
true (ByValue, ByPropertyName) |
Accept wildcard characters? |
true |
-childPath <string>
Specifies the elements to append to the value of Path. Wildcards are permitted. The ChildPath parameter is required, although the parameter name (-ChildPath) is optional.
Required? |
true |
Position? |
2 |
Default value |
N/A - The ChildPath must be specified |
Accept pipeline input? |
true (ByPropertyName) |
Accept wildcard characters? |
true |
-resolve <SwitchParameter>
Displays the items that are referenced by the joined path.
Required? |
false |
Position? |
named |
Default value |
False |
Accept pipeline input? |
false |
Accept wildcard characters? |
false |
-credential <PSCredential>
Uses a credential to validate access to the resource. <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 appears, but it is not supported in any Windows PowerShell core cmdlets or providers.
Required? |
false |
Position? |
named |
Default value |
|
Accept pipeline input? |
true (ByPropertyName) |
Accept wildcard characters? |
false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, and -OutVariable. For more information, type, "get-help about_commonparameters".
INPUT TYPE
String
RETURN TYPE
String
NOTES
For more information, type "Get-Help Join-Path -detailed". For technical information, type "Get-Help Join-Path -full".
The path cmdlets (*-path) manipulate path names and return the names in a concise format that all Windows 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.
You can use the path cmdlets with several providers, including the FileSystem, Registry, and Certificate providers.
When specifying multiple values for a parameter, use commas to separate the values. For example, "<parameter-name> <value1>, <value2>".
EXAMPLE 1
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.
c:\win*\System*
EXAMPLE 2
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.
C:\WINDOWS\system
C:\WINDOWS\system32
C:\WINDOWS\system.ini
EXAMPLE 3
PS HKLM:\> join-path System *ControlSet* -resolve
This command displays the registry keys in the HKLM\System hive that include "ControlSet". This example shows how to use Join-Path with the Windows PowerShell registry provider.
HKLM:\System\ControlSet001
HKLM:\System\ControlSet002
HKLM:\System\CurrentControlSet
RELATED LINKS