PowerShell 技能连载 - Getting File Extension
By converting a path to a FileInfo object, you can easily determine the path parent folder or file extension. Have a look:
([IO.FileInfo]'c:\test\abc.ps1').Extension
([IO.FileInfo]'c:\test\abc.ps1').DirectoryName
PowerShell 技能连载 - Getting File Extension