# Return just the file name
[System.IO.Path]::GetFileName($FilePath)
# Returns file name without the extension
[System.IO.Path]::GetFileNameWithoutExtension($FilePath)
# Returns the file extension only
[System.IO.Path]::GetExtension($FilePath)
Show examples of how to get the file name and extension information from the full file path
PS C:\> $FilePath = "C:\Scripts\ScriptSearcher.ps1" >> [System.IO.Path]::GetFileName($FilePath) >> [System.IO.Path]::GetFileNameWithoutExtension($FilePath) >> [System.IO.Path]::GetExtension($FilePath) ScriptSearcher.ps1 ScriptSearcher .ps1