function namei {
If ( $args[0] -eq $null ) {
$path = ($pwd).Path
} Else {
$path = $args[0]
}
If ( -not (Test-Path -Path $path) ) {
echo "Path does not exist"
return
}
While ( $path -ne "" ) {
$acl = Get-ACL -Path $path
echo $path "`r`n"
(
$acl | Select -Property Owner,Group | FL | Out-String
).Trim()
$acl | Select -Expand Access | Select -Property FileSystemRights,AccessControlType,IdentityReference,IsInherited | FT
$path = $path | Split-Path
}
}
namei C:\Windows