Category Archives: Path

Test-Path

NAME
    Test-Path

SYNOPSIS
    Determines whether all elements of a path exist.

SYNTAX
    Test-Path [-LiteralPath] <string[]> [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>] [-Include <string[]>] [-IsValid] [-PathType {Any | Container | Leaf}] [-UseTransaction] [<CommonParameters>]

    Test-Path [-Path] <string[]> [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>] [-Include <string[]>] [-IsValid] [-PathType {Any | Container | Leaf}] [-UseTransaction] [<CommonParameters>]

DESCRIPTION
    The Test-Path cmdlet determines whether all elements of the path exist. It returns TRUE ($true) if all elements exist and FALSE ($false) if any are missing. It can also tell whether the path syntax is valid and whether the path leads to a container or a terminal (leaf) element.

PARAMETERS
    -Credential <PSCredential>
        Specifies a user account that has permission to perform this action. The default is the current user.

        Type a user name, such as “User01” or “Domain01\User01”. Or, enter a PSCredential object, such as one generated by the Get-Credential cmdlet. If you type a user name, you will be prompted for a password.

        This parameter is not supported by any providers installed with Windows PowerShell.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -Exclude <string[]>
        Omits the specified items. The value of this parameter qualifies the Path parameter. Enter a path element or pattern, such as “*.txt”. Wildcards are permitted.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Filter <string>
        Specifies a filter in the provider’s format or language. The value of this parameter qualifies the Path parameter. The syntax of the filter, including the use of wildcards, depends on the provider. Filters are more efficient than other parameters, because the provider applies them when retrieving the objects rather than having Windows PowerShell filter the objects after they are retrieved.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Include <string[]>
        Tests only the specified paths. The value of this parameter qualifies the Path parameter. Enter a path element or pattern, such as “*.txt”. Wildcards are permitted.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -IsValid [<SwitchParameter>]
        Determines whether the syntax of the path is correct, regardless of whether the elements of the path exist. This parameter returns TRUE if the path syntax is valid and FALSE if it is not.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -LiteralPath <string[]>
        Specifies a path to be tested. Unlike Path, the value of the LiteralPath parameter is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell Windows PowerShell not to interpret any characters as escape sequences.

        Required?                    true
        Position?                    1
        Default value
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -Path <string[]>
        Specifies a path to be tested. Wildcards are permitted. If the path includes spaces, enclose it in quotation marks. The parameter name (“Path”) is optional.

        Required?                    true
        Position?                    1
        Default value
        Accept pipeline input?     true (ByValue, ByPropertyName)
        Accept wildcard characters? false

    -PathType <TestPathType>
        Tells whether the final element in the path is of a particular type. This parameter returns TRUE if the element is of the specified type and FALSE if it is not.

        Valid values are:
        — Container: An element that contains other elements, such as a directory or Registry key.

        — Leaf: An element that does not contain other elements, such as a file.

        — Any: Either a container or a leaf.Tells whether the final element in the path is of a particular type. Returns TRUE if the element is of the specified type and FALSE if it is not.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -UseTransaction [<SwitchParameter>]
        Includes the command in the active transaction. This parameter is valid only when a transaction is in progress. For more information, see about_transactions.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer and OutVariable. For more information, type,
        “Get-Help about_CommonParameters“.

INPUTS
    System.String
        You can pipe a string that contains a path (but not a literal path) to Test-Path.

OUTPUTS
    System.Boolean
        The cmdlet returns “True” when the path exists and “False” when it does not.

NOTES

        The cmdlets that contain the Path noun (the Path cmdlets) 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.

        The Test-Path cmdlet is designed to work with the data exposed by any provider. To list the providers available in your session, type “Get-PSProvider“. For more information, see about_providers.

    ————————– EXAMPLE 1 ————————–

    C:\PS>Test-Path -Path “C:\Documents and Settings\NicoleH”

    Description
    ———–
    This command tells whether all elements in the path exist, that is, the C: directory, the Documents and Settings directory, and the NicoleH directory. If any are missing, the cmdlet returns FALSE. Otherwise, it returns TRUE.

    ————————– EXAMPLE 2 ————————–

    C:\PS>Test-Path -Path $profile

    C:\PS>Test-Path -Path $profile -IsValid

    Description
    ———–
    These commands test the path to the Windows PowerShell profile.

    The first command determines whether all elements in the path exist. The second command determines whether the syntax of the path is correct. In this case, the path is FALSE, but the syntax is correct (TRUE). These commands use $profile, the automatic Variable that points to the location for the profile, even if the profile does not exist.

    For more information about automatic Variables, see about_Automatic_Variables.

    ————————– EXAMPLE 3 ————————–

    C:\PS>Test-Path -Path “C:\CAD\Commercial Buildings\*” -Exclude *.dwg

    Description
    ———–
    This command tells whether there are any files in the Commercial Buildings directory other than .dwg files.

    The command uses the Path parameter to specify the path. Because it includes a space, the path is enclosed in quotes. The asterisk at the end of the path indicates the contents of the Commercial Building directory. (With long paths, like this one, type the first few letters of the path, and then use the TAB key to complete the path.)

    The command uses the Exclude parameter to specify files that will be omitted from the evaluation.

    In this case, because the directory contains only .dwg files, the result is FALSE.

    ————————– EXAMPLE 4 ————————–

    C:\PS>Test-Path -Path $profile -Pathtype leaf

    Description
    ———–
    This command tells whether the path stored in the $profile Variable leads to a file. In this case, because the Windows PowerShell profile is a .ps1 file, the cmdlet returns TRUE.

    ————————– EXAMPLE 5 ————————–

    C:\PS>Test-Path -Path HKLM:\Software\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell

    TRUE

    C:\PS> Test-Path -Path HKLM:\Software\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell\ExecutionPolicy
    FALSE

    Description
    ———–
    These commands use the Test-Path cmdlet with the Windows PowerShell Registry provider.

    The first command tests whether the Registry path to the Microsoft.PowerShell Registry key is correct on the system. If Windows PowerShell is installed correctly, the cmdlet returns TRUE.

    Test-Path does not work correctly with all Windows PowerShell providers. For example, you can use Test-Path to test the path to a Registry key, but if you use it to test the path to a Registry entry, it always returns FALSE, even if the Registry entry is present.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113418
    about_providers
    Convert-Path
    Split-Path
    Resolve-Path
    Join-Path

Split-Path

NAME
    Split-Path

SYNOPSIS
    Returns the specified part of a path.

SYNTAX
    Split-Path [-IsAbsolute] [-Path] <string[]> [-Credential <PSCredential>] [-LiteralPath <string[]>] [-Resolve] [-UseTransaction] [<CommonParameters>]

    Split-Path [-Leaf] [-Path] <string[]> [-Credential <PSCredential>] [-LiteralPath <string[]>] [-Resolve] [-UseTransaction] [<CommonParameters>]

    Split-Path [-NoQualifier] [-Path] <string[]> [-Credential <PSCredential>] [-LiteralPath <string[]>] [-Resolve] [-UseTransaction] [<CommonParameters>]

    Split-Path [-Parent] [-Path] <string[]> [-Credential <PSCredential>] [-LiteralPath <string[]>] [-Resolve] [-UseTransaction] [<CommonParameters>]

    Split-Path [[-Qualifier]] [-Path] <string[]> [-Credential <PSCredential>] [-LiteralPath <string[]>] [-Resolve] [-UseTransaction] [<CommonParameters>]

DESCRIPTION
    The Split-Path cmdlet returns only the specified part of a path, such as the parent directory, a child directory, or a file name. It also can display the items that are referenced by the split path and tell whether the path is relative or absolute.

    You can use this cmdlet to display or submit only a selected part of a path.

PARAMETERS
    -Credential <PSCredential>
        Specifies a user account that has permission to perform this action. The default is the current user.

        Type a user name, such as “User01” or “Domain01\User01”. Or, enter a PSCredential object, such as one generated by the Get-Credential cmdlet. If you type a user name, you will be prompted for a password.

        This parameter is not supported by any providers installed with Windows PowerShell.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -IsAbsolute [<SwitchParameter>]
        Returns TRUE if the path is absolute and FALSE if it is relative. An absolute path has a length greater than zero and does not use a dot ( . ) to indicate the current path.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -Leaf [<SwitchParameter>]
        Returns only the last item or container in the path. For example, in the path “C:\Test\Logs\Pass1.log”, it returns only “Pass1.log”.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -LiteralPath <string[]>
        Specifies the paths to be split. Unlike Path, the value of LiteralPath is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell Windows PowerShell not to interpret any characters as escape sequences.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -NoQualifier [<SwitchParameter>]
        Returns the path without the qualifier. For the FileSystem or Registry providers, the qualifier is the drive of the provider path, such as C: or HKCU:. For example, in the path “C:\Test\Logs\Pass1.log”, it returns only “\Test\Logs\Pass1.log”.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -Parent [<SwitchParameter>]
        Returns only the parent containers of the item or of the container specified by the path. For example, in the path “C:\Test\Logs\Pass1.log”, it returns “C:\Test\Logs”. The Parent parameter is the default split location parameter.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -Path <string[]>
        Specifies the paths to be split. Wildcards are permitted. If the path includes spaces, enclose it in quotation marks. You can also pipe a path to Split-Path.

        Required?                    true
        Position?                    1
        Default value
        Accept pipeline input?     true (ByValue, ByPropertyName)
        Accept wildcard characters? false

    -Qualifier [<SwitchParameter>]
        Returns only the qualifier of the specified path. For the FileSystem or Registry providers, the qualifier is the drive of the provider path, such as C: or HKCU:.

        Required?                    false
        Position?                    2
        Default value
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -Resolve [<SwitchParameter>]
        Displays the items that are referenced by the resulting split path instead of displaying the path elements.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -UseTransaction [<SwitchParameter>]
        Includes the command in the active transaction. This parameter is valid only when a transaction is in progress. For more information, see about_transactions.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer and OutVariable. For more information, type,
        “Get-Help about_CommonParameters“.

INPUTS
    System.String
        You can pipe a string that contains a path to Split-Path.

OUTPUTS
    System.String
        The Split-Path cmdlet returns text strings. When you use the Resolve parameter, Split-Path returns a string that describes the location of the items; it does not return objects that represent the items, such as a FileInfo or RegistryKey object.

NOTES

        The split location parameters (Qualifier, Parent, Leaf, and NoQualifier) are exclusive. You can use only one in each command.

        The cmdlets that contain the Path noun (the Path cmdlets) 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.

        The Split-Path cmdlet is designed to work with the data exposed by any provider. To list the providers available in your session, type “Get-PSProvider“. For more information, see about_providers.

    ————————– EXAMPLE 1 ————————–

    C:\PS>Split-Path “HKCU:\Software\Microsoft” -qualifier

    HKCU:

    Description
    ———–
    This command returns only the qualifier (the drive) of the path.

    ————————– EXAMPLE 2 ————————–

    C:\PS>Split-Path “C:\Test\Logs\*.log” -leaf -Resolve

    Pass1.log
    Pass2.log
    …

    Description
    ———–
    This command displays the files that are referenced by the split path. Because this path is split to the last item (the “leaf”), only the file names of the paths are displayed.

    The Resolve parameter tells Split-Path to display the items that the split path references, instead of displaying the split path.

    Like all Split-Path commands, this command returns strings. It does not return FileInfo Objects representing the files.

    ————————– EXAMPLE 3 ————————–

    C:\PS>Split-Path “C:\WINDOWS\system32\WindowsPowerShell\V1.0\about_*.txt”

    C:\WINDOWS\system32\WindowsPowerShell\V1.0

    Description
    ———–
    This command returns only the parent containers of the path. Because it does not include any parameters to specify the split, Split-Path uses the split location default, which is Parent.

    ————————– EXAMPLE 4 ————————–

    C:\PS>Split-Path “.\My Pictures\*.jpg” -IsAbsolute

    False

    Description
    ———–
    This command determines whether the path is relative or absolute. In this case, because the path is relative to the current directory, which is represented by a dot (.), it returns FALSE ($false).

    ————————– EXAMPLE 5 ————————–

    C:\PS>Set-Location (Split-Path $profile)

    PS C:\Documents and Settings\juneb\My Documents\WindowsPowerShell>

    Description
    ———–
    This command changes your location to the directory that contains the Windows PowerShell profile.
    The command in parentheses uses the Split-Path cmdlet to return only the parent of the path stored in the built-in $Profile Variable. (The Parent parameter is the default split location parameter, so you can omit it from the command.) The parentheses direct Windows PowerShell to execute the command first. This is a handy way to navigate to a directory with a long path name.

    ————————– EXAMPLE 6 ————————–

    C:\PS>’C:\Documents and Settings\User01\My Documents\My Pictures’ | Split-Path

    C:\Documents and Settings\User01\My Documents

    Description
    ———–
    This command uses a pipeline operator (|) to send a path to the Split-Path cmdlet. The path is enclosed in quotation marks to indicate that it is a single token.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113404
    about_providers
    Test-Path
    Convert-Path
    Resolve-Path
    Join-Path

Resolve-Path

NAME
    Resolve-Path

SYNOPSIS
    Resolves the wildcard characters in a path, and displays the path contents.

SYNTAX
    Resolve-Path [-LiteralPath] <string[]> [-Credential <PSCredential>] [-Relative] [-UseTransaction] [<CommonParameters>]

    Resolve-Path [-Path] <string[]> [-Credential <PSCredential>] [-Relative] [-UseTransaction] [<CommonParameters>]

DESCRIPTION
    The Resolve-Path cmdlet interprets the wildcard characters in a path and displays the items and containers at the location specified by the path, such as the files and folders or Registry keys and subkeys.

PARAMETERS
    -Credential <PSCredential>
        Specifies a user account that has permission to perform this action. The default is the current user.

        Type a user name, such as “User01” or “Domain01\User01”. Or, enter a PSCredential object, such as one generated by the Get-Credential cmdlet. If you type a user name, you will be prompted for a password.

        This parameter is not supported by any providers installed with Windows PowerShell.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -LiteralPath <string[]>
        Specifies the path to be resolved. The value of LiteralPath is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell Windows PowerShell not to interpret any characters as escape sequences.

        Required?                    true
        Position?                    1
        Default value
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -Path <string[]>
        Specifies the Windows PowerShell path to resolve. This parameter is required. You can also pipe a path string to Resolve-Path.

        Required?                    true
        Position?                    1
        Default value
        Accept pipeline input?     true (ByValue, ByPropertyName)
        Accept wildcard characters? false

    -Relative [<SwitchParameter>]
        Returns a relative path.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -UseTransaction [<SwitchParameter>]
        Includes the command in the active transaction. This parameter is valid only when a transaction is in progress. For more information, see about_transactions.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer and OutVariable. For more information, type,
        “Get-Help about_CommonParameters“.

INPUTS
    System.String
        You can pipe a string that contains a path to Resolve-Path.

OUTPUTS
    System.String
        Resolve-Path returns a string that contains the resolved 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 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.

        The Resolve-Path cmdlet is designed to work with the data exposed by any provider. To list the providers available in your session, type “Get-PSProvider“. For more information, see about_providers.

    ————————– EXAMPLE 1 ————————–

    C:\PS>Resolve-Path ~

    C:\Users\User01

    Description
    ———–
    This command resolves the path represented by the tilde character (~), which signifies the home path.

    ————————– EXAMPLE 2 ————————–

    C:\PS>Resolve-Path windows

    C:\Windows

    Description
    ———–
    When run from the root of the C: drive, this command returns the path to the Windows directory in the C: drive.

    ————————– EXAMPLE 3 ————————–

    C:\PS>”C:\windows\*” | Resolve-Path

    Description
    ———–
    This command returns all of the directories in the C:\Windows directory. The command uses a pipeline operator (|) to send a path string to Resolve-Path.

    ————————– EXAMPLE 4 ————————–

    C:\PS>Resolve-Path \\Server01\public

    Description
    ———–
    This command resolves a Universal Naming Convention (UNC) path and returns the shares in the path.

    ————————– EXAMPLE 5 ————————–

    C:\PS>Resolve-Path c:\prog* -Relative

    ..\Program Files
    ..\Program Files (x86)
    ..\programs.txt

    Description
    ———–
    This command returns relative paths for the directories at the root of the C: drive.

    ————————– EXAMPLE 6 ————————–

    C:\PS>Resolve-Path -literalPath test[xml]

    Description
    ———–
    This command resolves the path to the Test[xml] subdirectory of the current directory. It uses the LiteralPath parameter to indicate that the brackets are not regular expression characters.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113384
    about_providers
    Test-Path
    Split-Path
    Convert-Path
    Join-Path

Join-Path

NAME
    Join-Path

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>]

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

PARAMETERS
    -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
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -Credential <PSCredential>
        Specifies a user account that has permission to perform this action. The default is the current user.

        Type a user name, such as “User01” or “Domain01\User01”. Or, enter a PSCredential object, such as one generated by the Get-Credential cmdlet. If you type a user name, you will be prompted for a password.

        This parameter is not supported by any providers installed with Windows PowerShell.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -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
        Accept pipeline input?     true (ByValue, ByPropertyName)
        Accept wildcard characters? false

    -Resolve [<SwitchParameter>]
        Displays the items that are referenced by the joined path.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    -UseTransaction [<SwitchParameter>]
        Includes the command in the active transaction. This parameter is valid only when a transaction is in progress. For more information, see about_transactions.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer and OutVariable. For more information, type,
        “Get-Help about_CommonParameters“.

INPUTS
    System.String
        You can pipe a string that contains a path to Join-Path.

OUTPUTS
    System.String
        Join-Path 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 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.

        The Join-Path cmdlet is designed to work with the data exposed by any provider. To list the providers available in your session, type “Get-PSProvider“. For more information, see about_providers.

    ————————– EXAMPLE 1 ————————–

    C:\PS>Join-Path -Path c:\win* -ChildPath System*

    Description
    ———–
    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 ————————–

    C:\PS>Join-Path c:\win* System* -Resolve

    Description
    ———–
    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 ————————–

    C:\PS>PS HKLM:\> Join-Path System *ControlSet* -Resolve

    Description
    ———–
    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 ————————–

    C:\PS>Join-Path -Path C:, D:, E:, F: -ChildPath New

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

    ————————– EXAMPLE 5 ————————–

    C:\PS>Get-PSDrive -psprovider FileSystem | foreach {$_.root} | Join-Path -ChildPath Subdir

    Description
    ———–
    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.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113347
    about_providers
    Test-Path
    Split-Path
    Resolve-Path
    Convert-Path

Convert-Path

NAME
    Convert-Path

SYNOPSIS
    Converts a path from a Windows PowerShell path to a Windows PowerShell provider path.

SYNTAX
    Convert-Path [-LiteralPath] <string[]> [-UseTransaction] [<CommonParameters>]

    Convert-Path [-Path] <string[]> [-UseTransaction] [<CommonParameters>]

DESCRIPTION
    The Convert-Path cmdlet converts a path from a Windows PowerShell path to a Windows PowerShell provider path.

PARAMETERS
    -LiteralPath <string[]>
        Specifies the path to be converted. The value of the LiteralPath parameter is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell Windows PowerShell not to interpret any characters as escape sequences.

        Required?                    true
        Position?                    1
        Default value
        Accept pipeline input?     true (ByPropertyName)
        Accept wildcard characters? false

    -Path <string[]>
        Specifies the Windows PowerShell path to be converted.

        Required?                    true
        Position?                    1
        Default value
        Accept pipeline input?     true (ByValue, ByPropertyName)
        Accept wildcard characters? false

    -UseTransaction [<SwitchParameter>]
        Includes the command in the active transaction. This parameter is valid only when a transaction is in progress. For more information, see about_transactions.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?     false
        Accept wildcard characters? false

    <CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer and OutVariable. For more information, type,
        “Get-Help about_CommonParameters“.

INPUTS
    System.String
        You can pipe a path (but not a literal path) to Convert-Path.

OUTPUTS
    System.String
        Convert-Path returns a string that contains the converted 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 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.

        The Convert-Path cmdlet is designed to work with the data exposed by any provider. To list the providers available in your session, type “Get-PSProvider“. For more information, see about_providers.

    ————————– EXAMPLE 1 ————————–

    C:\PS>Convert-Path ~

    Description
    ———–
    This command expands the current working directory.

    ————————– EXAMPLE 2 ————————–

    C:\PS>Convert-Path HKLM:\software\microsoft

    Description
    ———–
    This command converts the Windows PowerShell provider path to a standard Registry path.

RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113289
    about_providers
    Test-Path
    Split-Path
    Resolve-Path
    Join-Path