← Docs home

Support Windows PowerShell Paths

📐 Guideline.

The PowerShell path normalizes access to namespaces. When you assign a PowerShell path to a parameter, the user can define a custom "drive" that acts as a shortcut to a specific path, so stored data such as the Registry can be used in a consistent way.

Path parameter shape.

If your cmdlet lets the user specify a file or a data source, define a parameter of type System.String. If more than one drive is supported, use an array. Name the parameter Path, with an alias of PSPath, and have it support wildcard characters. If wildcard support is not required, define a LiteralPath parameter instead.

Translating paths for the file system.

If the data must be a file, accept PowerShell path input and use the SessionState.Path property to translate PowerShell paths into paths the file system recognizes. The mechanisms include:

Reading string content.

If the data is only a set of strings instead of a file, use the provider content information, the Content member, obtained from the CmdletProvider.InvokeProvider property to read and write. This lets other data stores participate in reading and writing data.