commands detail - b

basename

A rough PowerShell equivalent for the unix basename is:

  1. dir <whatever> | select name

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