Contact Info

Crumbtrail » Administration » Powershell » Powershell 1.0 » Join-Path

Join-Path - Powershell 1.0 CmdLet

Microsoft Windows PowerShell is a command-line shell and scripting tool based on the Microsoft .NET Framework. It is designed for system administrators, engineers and developers to control and automate the administration of Windows and applications.

More than hundred command-line tools (so called "cmdlets") can be used to perform system administration tasks and Windows Management Instrumentation (WMI). These cmdlets are easy to use, with standard naming conventions and common parameters, and standard tools for piping, sorting, filtering, and formatting data and objects.


Combine a path and child-path


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

       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.

      -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutVariable.

Join two paths:

PS C:\>join-path -path c:\docu* -childpath A*

The above will resolve to: C:\docu*\A*

Get ACL information for all of the .log files in the Windows directory beginning with k.
Display output as a table showing the MshPath and the owner of each file:

PS C:\>join-path -path c:\docu* A* -resolve

The above will resolve to:

C:\Documents and Settings\Administrator
C:\Documents and Settings\All Users

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

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