< Back

Resolve-PSFPath

Sun Jan 19, 2020 6:44 pm

NAME Resolve-PSFPath



SYNOPSIS

Resolves a path.





SYNTAX

Resolve-PSFPath [-Path] <String[]> [-Provider <String>] [-SingleItem] [-NewChild] [<CommonParameters>]





DESCRIPTION

Resolves a path.

Will try to resolve to paths including some basic path validation and resolution.

Will fail if the path cannot be resolved (so an existing path must be reached at).





PARAMETERS

-Path <String[]>

The path to validate.



Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Provider <String>

Ensure the path is of the expected provider.

Allows ensuring one does not operate in the wrong provider.

Common providers include the filesystem, the registry or the active directory.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-SingleItem [<SwitchParameter>]

Ensure the path should resolve to a single path only.

This may - intentionally or not - trip up wildcard paths.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-NewChild [<SwitchParameter>]

Assumes one wishes to create a new child item.

The parent path will be resolved and must validate true.

The final leaf will be treated as a leaf item that does not exist yet.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Resolve-PSFPath -Path report.log -Provider FileSystem -NewChild -SingleItem



Ensures the resolved path is a FileSystem path.

This will resolve to the current folder and the file report.log.

Will not ensure the file exists or doesn't exist.

If the current path is in a different provider, it will throw an exception.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Resolve-PSFPath -Path ..\\*



This will resolve all items in the parent folder, whatever the current path or drive might be.











RELATED LINKS