Created
January 6, 2022 15:53
-
-
Save JohnL4/87a8a3ae6db73e2a5040019d543dc22e to your computer and use it in GitHub Desktop.
PowerShell filename parts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$f = ls foo/bar.txt | |
$f | select Directory,DirectoryName,BaseName,Extension | |
# More generic than just filesystem provider (e.g., registry keys) | |
$f | split-path -parent # Container | |
$f | split-path -leaf # Contained child | |
$f | split-path -noqualifier # Drive letter only or, for example, "HKCU:" | |
$f | split-path -qualifier # No qualifier |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment