19.1. Path Names in Windows PowerShell

When you specify a path name in Windows PowerShell you have two options—a fully qualified path name or a relative path name.

19.1.1. Fully Qualified Path Names

A fully qualified path name differs from absolute paths you may be familiar with in other contexts, since it may include the name of the Windows PowerShell provider that enables file system operations. A fully qualified name takes this form:

ProviderName::drive:\container\...\item

NOTE

The preceding syntax applies to paths in all drives exposed by Windows PowerShell, not just those in the file system. In the context of the FileSystem provider the container is a folder (directory) and the item is a file.

An optional provider name is followed by a pair of colon characters if the provider name is used. Strictly speaking, the provider name is never needed, since drive names should be unique across a system. The drive name is followed by a single colon character and a backslash. Actually, Windows PowerShell will support the forward slash, too, if you are used to that convention due to a Unix or Linux background. Optionally, additional subcontainers (folders) can be included, as appropriate, in the path. The item is also optional, when the fully qualified path refers to a folder.

The following command lists all folders (and any files) in the C:\Program Files folder that begin with the character sequence mi:

get-childitem "FileSystem::C:\Program Files\mi*"

If you prefer, you can type the ...

Get Professional Windows® PowerShell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.