
A rough PowerShell equivalent for the unix basename is:
![]()
This depends on the file actually existing, whereas basename doesn’t care.
A more precise (but perhaps less concise) alternative[1] is:
[System.IO.Path]::GetFileName('c:\temp\double_winners.txt')

Notes[1] I found [System.IO.Path]::GetFileName after reading Power Tips of the Day - Useful Path Manipulations Shortcuts, which has some other useful commands
Describe what you're looking for in as much detail as you'd like — our AI reads your request and finds the best matching books for you.
Popular searches:
Join 2 million readers and get unlimited free ebooks