IsPathRooted to check if the passed parameter is an absolute or relatie path. param(
[parameter(mandatory=$true)]
$path
)
if ( [System.IO.Path]::IsPathRooted($path) ) {
write-host "$path is absolute"
}
else {
write-host "$path is not absolute"
}
IsPathRooted() does not verify if the actual path actually exists. -isAbsolute option of the cmdLet split-path.